2022-02-22 15:39:11 +01:00
import { BehaviorSubject } from "rxjs" ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
import { LogService } from "../abstractions/log.service" ;
2022-02-22 15:39:11 +01:00
import { StateService as StateServiceAbstraction } from "../abstractions/state.service" ;
import { StateMigrationService } from "../abstractions/stateMigration.service" ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
import { StorageService } from "../abstractions/storage.service" ;
import { HtmlStorageLocation } from "../enums/htmlStorageLocation" ;
import { KdfType } from "../enums/kdfType" ;
import { StorageLocation } from "../enums/storageLocation" ;
2022-01-28 11:28:36 +01:00
import { ThemeType } from "../enums/themeType" ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
import { UriMatchType } from "../enums/uriMatchType" ;
2022-02-22 15:39:11 +01:00
import { StateFactory } from "../factories/stateFactory" ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
import { CipherData } from "../models/data/cipherData" ;
import { CollectionData } from "../models/data/collectionData" ;
import { EventData } from "../models/data/eventData" ;
import { FolderData } from "../models/data/folderData" ;
import { OrganizationData } from "../models/data/organizationData" ;
import { PolicyData } from "../models/data/policyData" ;
import { ProviderData } from "../models/data/providerData" ;
import { SendData } from "../models/data/sendData" ;
2022-02-22 15:39:11 +01:00
import { Account , AccountData } from "../models/domain/account" ;
import { EncString } from "../models/domain/encString" ;
2022-01-07 15:30:54 +01:00
import { EnvironmentUrls } from "../models/domain/environmentUrls" ;
2022-02-22 15:39:11 +01:00
import { GeneratedPasswordHistory } from "../models/domain/generatedPasswordHistory" ;
import { GlobalState } from "../models/domain/globalState" ;
import { Policy } from "../models/domain/policy" ;
import { State } from "../models/domain/state" ;
import { StorageOptions } from "../models/domain/storageOptions" ;
import { SymmetricCryptoKey } from "../models/domain/symmetricCryptoKey" ;
2022-01-27 16:44:09 +01:00
import { WindowState } from "../models/domain/windowState" ;
2022-02-22 15:39:11 +01:00
import { CipherView } from "../models/view/cipherView" ;
import { CollectionView } from "../models/view/collectionView" ;
import { FolderView } from "../models/view/folderView" ;
import { SendView } from "../models/view/sendView" ;
2022-01-31 20:33:31 +01:00
2022-01-19 16:51:10 +01:00
const keys = {
global : "global" ,
authenticatedAccounts : "authenticatedAccounts" ,
activeUserId : "activeUserId" ,
2022-01-20 14:30:00 +01:00
tempAccountSettings : "tempAccountSettings" , // used to hold account specific settings (i.e clear clipboard) between initial migration and first account authentication
2022-02-07 17:36:53 +01:00
accountActivity : "accountActivity" ,
2022-01-19 16:51:10 +01:00
} ;
const partialKeys = {
autoKey : "_masterkey_auto" ,
biometricKey : "_masterkey_biometric" ,
masterKey : "_masterkey" ,
} ;
2022-01-31 20:33:31 +01:00
export class StateService <
2022-02-03 19:32:42 +01:00
TGlobalState extends GlobalState = GlobalState ,
TAccount extends Account = Account
2022-01-31 20:33:31 +01:00
> implements StateServiceAbstraction < TAccount >
2021-12-20 14:48:47 +01:00
{
accounts = new BehaviorSubject < { [ userId : string ] : TAccount } > ( { } ) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
activeAccount = new BehaviorSubject < string > ( null ) ;
2021-12-16 13:36:21 +01:00
2022-02-03 19:32:42 +01:00
protected state : State < TGlobalState , TAccount > = new State < TGlobalState , TAccount > (
2022-01-31 20:33:31 +01:00
this . createGlobals ( )
) ;
2021-12-16 13:36:21 +01:00
2022-02-22 15:39:11 +01:00
private hasBeenInited = false ;
2022-01-24 20:37:52 +01:00
2022-02-11 06:20:50 +01:00
private accountDiskCache : Map < string , TAccount > ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
constructor (
2021-12-20 14:48:47 +01:00
protected storageService : StorageService ,
protected secureStorageService : StorageService ,
protected logService : LogService ,
2022-01-19 16:51:10 +01:00
protected stateMigrationService : StateMigrationService ,
2022-02-14 17:47:01 +01:00
protected stateFactory : StateFactory < TGlobalState , TAccount > ,
protected useAccountCache : boolean = true
2022-02-11 06:20:50 +01:00
) {
this . accountDiskCache = new Map < string , TAccount > ( ) ;
}
2021-12-16 13:36:21 +01:00
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async init ( ) : Promise < void > {
2022-01-24 20:37:52 +01:00
if ( this . hasBeenInited ) {
return ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
if ( await this . stateMigrationService . needsMigration ( ) ) {
await this . stateMigrationService . migrate ( ) ;
}
2022-01-19 16:51:10 +01:00
await this . initAccountState ( ) ;
2022-01-24 20:37:52 +01:00
this . hasBeenInited = true ;
2022-01-19 16:51:10 +01:00
}
async initAccountState() {
this . state . authenticatedAccounts =
( await this . storageService . get < string [ ] > ( keys . authenticatedAccounts ) ) ? ? [ ] ;
for ( const i in this . state . authenticatedAccounts ) {
if ( i != null ) {
await this . syncAccountFromDisk ( this . state . authenticatedAccounts [ i ] ) ;
}
}
const storedActiveUser = await this . storageService . get < string > ( keys . activeUserId ) ;
if ( storedActiveUser != null ) {
this . state . activeUserId = storedActiveUser ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
}
2022-01-19 16:51:10 +01:00
await this . pushAccounts ( ) ;
this . activeAccount . next ( this . state . activeUserId ) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
}
2021-12-16 13:36:21 +01:00
2022-01-19 16:51:10 +01:00
async syncAccountFromDisk ( userId : string ) {
if ( userId == null ) {
return ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
}
2022-01-19 16:51:10 +01:00
this . state . accounts [ userId ] = this . createAccount ( ) ;
const diskAccount = await this . getAccountFromDisk ( { userId : userId } ) ;
this . state . accounts [ userId ] . profile = diskAccount . profile ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
}
2021-12-16 13:36:21 +01:00
2021-12-20 14:48:47 +01:00
async addAccount ( account : TAccount ) {
2022-01-19 16:51:10 +01:00
account = await this . setAccountEnvironmentUrls ( account ) ;
this . state . authenticatedAccounts . push ( account . profile . userId ) ;
2022-02-07 17:36:53 +01:00
await this . storageService . save ( keys . authenticatedAccounts , this . state . authenticatedAccounts ) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . state . accounts [ account . profile . userId ] = account ;
await this . scaffoldNewAccountStorage ( account ) ;
2022-02-09 18:15:20 +01:00
await this . setLastActive ( new Date ( ) . getTime ( ) , { userId : account.profile.userId } ) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . setActiveUser ( account . profile . userId ) ;
this . activeAccount . next ( account . profile . userId ) ;
}
2021-12-16 13:36:21 +01:00
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setActiveUser ( userId : string ) : Promise < void > {
2022-01-19 16:51:10 +01:00
this . clearDecryptedDataForActiveUser ( ) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . state . activeUserId = userId ;
2022-01-19 16:51:10 +01:00
await this . storageService . save ( keys . activeUserId , userId ) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . activeAccount . next ( this . state . activeUserId ) ;
2022-01-19 16:51:10 +01:00
await this . pushAccounts ( ) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
}
2021-12-16 13:36:21 +01:00
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async clean ( options? : StorageOptions ) : Promise < void > {
2022-01-19 16:51:10 +01:00
options = this . reconcileOptions ( options , this . defaultInMemoryOptions ) ;
await this . deAuthenticateAccount ( options . userId ) ;
if ( options . userId === this . state . activeUserId ) {
await this . dynamicallySetActiveUser ( ) ;
2021-12-16 13:36:21 +01:00
}
2022-01-19 16:51:10 +01:00
await this . removeAccountFromDisk ( options ? . userId ) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . removeAccountFromMemory ( options ? . userId ) ;
await this . pushAccounts ( ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getAccessToken ( options? : StorageOptions ) : Promise < string > {
2022-02-11 15:38:00 +01:00
options = await this . getTimeoutBasedStorageOptions ( options ) ;
2022-02-09 23:01:43 +01:00
return ( await this . getAccount ( options ) ) ? . tokens ? . accessToken ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setAccessToken ( value : string , options? : StorageOptions ) : Promise < void > {
2022-02-11 15:38:00 +01:00
options = await this . getTimeoutBasedStorageOptions ( options ) ;
2022-02-09 23:01:43 +01:00
const account = await this . getAccount ( options ) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . tokens . accessToken = value ;
2022-02-09 23:01:43 +01:00
await this . saveAccount ( account , options ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getAddEditCipherInfo ( options? : StorageOptions ) : Promise < any > {
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . data ? . addEditCipherInfo ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setAddEditCipherInfo ( value : any , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . addEditCipherInfo = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getAlwaysShowDock ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
2022-01-20 15:03:31 +01:00
( await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . alwaysShowDock ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setAlwaysShowDock ( value : boolean , options? : StorageOptions ) : Promise < void > {
2022-01-20 15:03:31 +01:00
const globals = await this . getGlobals (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
2022-01-20 15:03:31 +01:00
globals . alwaysShowDock = value ;
await this . saveGlobals (
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getApiKeyClientId ( options? : StorageOptions ) : Promise < string > {
2022-02-11 15:38:00 +01:00
options = await this . getTimeoutBasedStorageOptions ( options ) ;
2022-02-09 23:01:43 +01:00
return ( await this . getAccount ( options ) ) ? . profile ? . apiKeyClientId ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setApiKeyClientId ( value : string , options? : StorageOptions ) : Promise < void > {
2022-02-11 15:38:00 +01:00
options = await this . getTimeoutBasedStorageOptions ( options ) ;
2022-02-09 23:01:43 +01:00
const account = await this . getAccount ( options ) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . profile . apiKeyClientId = value ;
2022-02-09 23:01:43 +01:00
await this . saveAccount ( account , options ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getApiKeyClientSecret ( options? : StorageOptions ) : Promise < string > {
2022-02-11 15:38:00 +01:00
options = await this . getTimeoutBasedStorageOptions ( options ) ;
2022-02-09 23:01:43 +01:00
return ( await this . getAccount ( options ) ) ? . keys ? . apiKeyClientSecret ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setApiKeyClientSecret ( value : string , options? : StorageOptions ) : Promise < void > {
2022-02-11 15:38:00 +01:00
options = await this . getTimeoutBasedStorageOptions ( options ) ;
2022-02-09 23:01:43 +01:00
const account = await this . getAccount ( options ) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . keys . apiKeyClientSecret = value ;
2022-02-09 23:01:43 +01:00
await this . saveAccount ( account , options ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getAutoConfirmFingerPrints ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . settings ? . autoConfirmFingerPrints ? ? true
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setAutoConfirmFingerprints ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . autoConfirmFingerPrints = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getAutoFillOnPageLoadDefault ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
2022-03-01 04:13:19 +01:00
? . settings ? . autoFillOnPageLoadDefault ? ? true
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setAutoFillOnPageLoadDefault ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . autoFillOnPageLoadDefault = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getBiometricAwaitingAcceptance ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . biometricAwaitingAcceptance ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setBiometricAwaitingAcceptance ( value : boolean , options? : StorageOptions ) : Promise < void > {
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . biometricAwaitingAcceptance = value ;
await this . saveGlobals (
2021-12-16 13:36:21 +01:00
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getBiometricFingerprintValidated ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . biometricFingerprintValidated ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setBiometricFingerprintValidated ( value : boolean , options? : StorageOptions ) : Promise < void > {
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . biometricFingerprintValidated = value ;
await this . saveGlobals (
2021-12-16 13:36:21 +01:00
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getBiometricLocked ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ) ? . settings
? . biometricLocked ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setBiometricLocked ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . biometricLocked = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getBiometricText ( options? : StorageOptions ) : Promise < string > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . biometricText ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setBiometricText ( value : string , options? : StorageOptions ) : Promise < void > {
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . biometricText = value ;
await this . saveGlobals (
2021-12-16 13:36:21 +01:00
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getBiometricUnlock ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . settings ? . biometricUnlock ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setBiometricUnlock ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . biometricUnlock = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getCanAccessPremium ( options? : StorageOptions ) : Promise < boolean > {
if ( ! ( await this . getIsAuthenticated ( options ) ) ) {
return false ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
if ( account . profile . hasPremiumPersonally ) {
return true ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
const organizations = await this . getOrganizations ( options ) ;
if ( organizations == null ) {
return false ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
for ( const id of Object . keys ( organizations ) ) {
const o = organizations [ id ] ;
if ( o . enabled && o . usersGetPremium && ! o . isProviderUser ) {
return true ;
2021-12-16 13:36:21 +01:00
}
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
return false ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getClearClipboard ( options? : StorageOptions ) : Promise < number > {
2021-12-16 13:36:21 +01:00
return (
2022-01-12 15:11:25 +01:00
(
await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
)
) ? . settings ? . clearClipboard ? ? null
) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setClearClipboard ( value : number , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . clearClipboard = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
2022-02-15 18:54:22 +01:00
async getCollapsedGroupings ( options? : StorageOptions ) : Promise < string [ ] > {
return (
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) ) )
2022-02-25 13:03:13 +01:00
) ? . settings ? . collapsedGroupings ;
2021-12-16 13:36:21 +01:00
}
2022-02-15 18:54:22 +01:00
async setCollapsedGroupings ( value : string [ ] , options? : StorageOptions ) : Promise < void > {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
const account = await this . getAccount (
2022-02-15 18:54:22 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
2022-02-25 13:03:13 +01:00
account . settings . collapsedGroupings = value ;
2022-02-15 18:54:22 +01:00
await this . saveAccount (
account ,
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getConvertAccountToKeyConnector ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . profile ? . convertAccountToKeyConnector ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setConvertAccountToKeyConnector ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . profile . convertAccountToKeyConnector = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getCryptoMasterKey ( options? : StorageOptions ) : Promise < SymmetricCryptoKey > {
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . keys ? . cryptoMasterKey ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setCryptoMasterKey ( value : SymmetricCryptoKey , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . keys . cryptoMasterKey = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getCryptoMasterKeyAuto ( options? : StorageOptions ) : Promise < string > {
options = this . reconcileOptions (
this . reconcileOptions ( options , { keySuffix : "auto" } ) ,
await this . defaultSecureStorageOptions ( )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
if ( options ? . userId == null ) {
return null ;
2021-12-16 13:36:21 +01:00
}
2022-01-19 16:51:10 +01:00
return await this . secureStorageService . get ( ` ${ options . userId } ${ partialKeys . autoKey } ` , options ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setCryptoMasterKeyAuto ( value : string , options? : StorageOptions ) : Promise < void > {
options = this . reconcileOptions (
this . reconcileOptions ( options , { keySuffix : "auto" } ) ,
await this . defaultSecureStorageOptions ( )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
if ( options ? . userId == null ) {
2021-12-16 13:36:21 +01:00
return ;
}
2022-01-19 16:51:10 +01:00
await this . secureStorageService . save ( ` ${ options . userId } ${ partialKeys . autoKey } ` , value , options ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getCryptoMasterKeyB64 ( options? : StorageOptions ) : Promise < string > {
options = this . reconcileOptions ( options , await this . defaultSecureStorageOptions ( ) ) ;
if ( options ? . userId == null ) {
return null ;
2021-12-16 13:36:21 +01:00
}
2022-01-19 16:51:10 +01:00
return await this . secureStorageService . get (
` ${ options ? . userId } ${ partialKeys . masterKey } ` ,
options
) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setCryptoMasterKeyB64 ( value : string , options? : StorageOptions ) : Promise < void > {
options = this . reconcileOptions ( options , await this . defaultSecureStorageOptions ( ) ) ;
if ( options ? . userId == null ) {
2021-12-16 13:36:21 +01:00
return ;
}
2022-01-19 16:51:10 +01:00
await this . secureStorageService . save (
` ${ options . userId } ${ partialKeys . masterKey } ` ,
value ,
options
) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getCryptoMasterKeyBiometric ( options? : StorageOptions ) : Promise < string > {
options = this . reconcileOptions (
this . reconcileOptions ( options , { keySuffix : "biometric" } ) ,
await this . defaultSecureStorageOptions ( )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
if ( options ? . userId == null ) {
return null ;
2021-12-16 13:36:21 +01:00
}
2022-01-19 16:51:10 +01:00
return await this . secureStorageService . get (
` ${ options . userId } ${ partialKeys . biometricKey } ` ,
options
) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async hasCryptoMasterKeyBiometric ( options? : StorageOptions ) : Promise < boolean > {
options = this . reconcileOptions (
this . reconcileOptions ( options , { keySuffix : "biometric" } ) ,
await this . defaultSecureStorageOptions ( )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
if ( options ? . userId == null ) {
return false ;
2021-12-16 13:36:21 +01:00
}
2022-01-19 16:51:10 +01:00
return await this . secureStorageService . has (
` ${ options . userId } ${ partialKeys . biometricKey } ` ,
options
) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setCryptoMasterKeyBiometric ( value : string , options? : StorageOptions ) : Promise < void > {
options = this . reconcileOptions (
this . reconcileOptions ( options , { keySuffix : "biometric" } ) ,
await this . defaultSecureStorageOptions ( )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
if ( options ? . userId == null ) {
2021-12-16 13:36:21 +01:00
return ;
}
2022-01-19 16:51:10 +01:00
await this . secureStorageService . save (
` ${ options . userId } ${ partialKeys . biometricKey } ` ,
value ,
options
) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDecodedToken ( options? : StorageOptions ) : Promise < any > {
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . tokens ? . decodedToken ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDecodedToken ( value : any , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . tokens . decodedToken = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDecryptedCiphers ( options? : StorageOptions ) : Promise < CipherView [ ] > {
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . data ? . ciphers ? . decrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDecryptedCiphers ( value : CipherView [ ] , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . ciphers . decrypted = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDecryptedCollections ( options? : StorageOptions ) : Promise < CollectionView [ ] > {
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . data ? . collections ? . decrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDecryptedCollections ( value : CollectionView [ ] , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . collections . decrypted = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDecryptedCryptoSymmetricKey ( options? : StorageOptions ) : Promise < SymmetricCryptoKey > {
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . keys ? . cryptoSymmetricKey ? . decrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDecryptedCryptoSymmetricKey (
value : SymmetricCryptoKey ,
options? : StorageOptions
) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . keys . cryptoSymmetricKey . decrypted = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDecryptedFolders ( options? : StorageOptions ) : Promise < FolderView [ ] > {
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . data ? . folders ? . decrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDecryptedFolders ( value : FolderView [ ] , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . folders . decrypted = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDecryptedOrganizationKeys (
options? : StorageOptions
) : Promise < Map < string , SymmetricCryptoKey > > {
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . keys ? . organizationKeys ? . decrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDecryptedOrganizationKeys (
value : Map < string , SymmetricCryptoKey > ,
options? : StorageOptions
) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . keys . organizationKeys . decrypted = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDecryptedPasswordGenerationHistory (
options? : StorageOptions
) : Promise < GeneratedPasswordHistory [ ] > {
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . data ? . passwordGenerationHistory ? . decrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDecryptedPasswordGenerationHistory (
value : GeneratedPasswordHistory [ ] ,
options? : StorageOptions
) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . passwordGenerationHistory . decrypted = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDecryptedPinProtected ( options? : StorageOptions ) : Promise < EncString > {
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . settings ? . pinProtected ? . decrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDecryptedPinProtected ( value : EncString , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . pinProtected . decrypted = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDecryptedPolicies ( options? : StorageOptions ) : Promise < Policy [ ] > {
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . data ? . policies ? . decrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDecryptedPolicies ( value : Policy [ ] , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . policies . decrypted = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDecryptedPrivateKey ( options? : StorageOptions ) : Promise < ArrayBuffer > {
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . keys ? . privateKey ? . decrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDecryptedPrivateKey ( value : ArrayBuffer , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . keys . privateKey . decrypted = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDecryptedProviderKeys (
options? : StorageOptions
) : Promise < Map < string , SymmetricCryptoKey > > {
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . keys ? . providerKeys ? . decrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDecryptedProviderKeys (
value : Map < string , SymmetricCryptoKey > ,
options? : StorageOptions
) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . keys . providerKeys . decrypted = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDecryptedSends ( options? : StorageOptions ) : Promise < SendView [ ] > {
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . data ? . sends ? . decrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDecryptedSends ( value : SendView [ ] , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . sends . decrypted = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDefaultUriMatch ( options? : StorageOptions ) : Promise < UriMatchType > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . settings ? . defaultUriMatch ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDefaultUriMatch ( value : UriMatchType , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . defaultUriMatch = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDisableAddLoginNotification ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . settings ? . disableAddLoginNotification ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDisableAddLoginNotification ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . disableAddLoginNotification = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDisableAutoBiometricsPrompt ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . settings ? . disableAutoBiometricsPrompt ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDisableAutoBiometricsPrompt ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . disableAutoBiometricsPrompt = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDisableAutoTotpCopy ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . settings ? . disableAutoTotpCopy ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDisableAutoTotpCopy ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . disableAutoTotpCopy = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDisableBadgeCounter ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . settings ? . disableBadgeCounter ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDisableBadgeCounter ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . disableBadgeCounter = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDisableChangedPasswordNotification ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . settings ? . disableChangedPasswordNotification ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDisableChangedPasswordNotification (
value : boolean ,
options? : StorageOptions
) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . disableChangedPasswordNotification = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDisableContextMenuItem ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . settings ? . disableContextMenuItem ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDisableContextMenuItem ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . disableContextMenuItem = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDisableFavicon ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
(
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
)
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
) ? . disableFavicon ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDisableFavicon ( value : boolean , options? : StorageOptions ) : Promise < void > {
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . disableFavicon = value ;
await this . saveGlobals (
2021-12-16 13:36:21 +01:00
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDisableGa ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . settings ? . disableGa ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDisableGa ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . disableGa = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDontShowCardsCurrentTab ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . settings ? . dontShowCardsCurrentTab ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDontShowCardsCurrentTab ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . dontShowCardsCurrentTab = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getDontShowIdentitiesCurrentTab ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . settings ? . dontShowIdentitiesCurrentTab ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setDontShowIdentitiesCurrentTab ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . dontShowIdentitiesCurrentTab = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEmail ( options? : StorageOptions ) : Promise < string > {
2022-01-19 16:51:10 +01:00
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . profile ? . email ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEmail ( value : string , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
2022-01-19 16:51:10 +01:00
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . profile . email = value ;
2022-01-19 16:51:10 +01:00
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEmailVerified ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . profile . emailVerified ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEmailVerified ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . profile . emailVerified = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEnableAlwaysOnTop ( options? : StorageOptions ) : Promise < boolean > {
const accountPreference = (
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . settings ? . enableAlwaysOnTop ;
const globalPreference = (
await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . enableAlwaysOnTop ;
return accountPreference ? ? globalPreference ? ? false ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEnableAlwaysOnTop ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . enableAlwaysOnTop = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . enableAlwaysOnTop = value ;
await this . saveGlobals (
2021-12-16 13:36:21 +01:00
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEnableAutoFillOnPageLoad ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . settings ? . enableAutoFillOnPageLoad ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEnableAutoFillOnPageLoad ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . enableAutoFillOnPageLoad = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEnableBiometric ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . enableBiometrics ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEnableBiometric ( value : boolean , options? : StorageOptions ) : Promise < void > {
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . enableBiometrics = value ;
await this . saveGlobals (
2021-12-16 13:36:21 +01:00
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEnableBrowserIntegration ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
2022-01-24 16:47:41 +01:00
( await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . enableBrowserIntegration ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEnableBrowserIntegration ( value : boolean , options? : StorageOptions ) : Promise < void > {
2022-01-24 16:47:41 +01:00
const globals = await this . getGlobals (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
2022-01-24 16:47:41 +01:00
globals . enableBrowserIntegration = value ;
await this . saveGlobals (
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEnableBrowserIntegrationFingerprint ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
2022-01-24 16:47:41 +01:00
( await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . enableBrowserIntegrationFingerprint ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEnableBrowserIntegrationFingerprint (
value : boolean ,
options? : StorageOptions
) : Promise < void > {
2022-01-24 16:47:41 +01:00
const globals = await this . getGlobals (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
2022-01-24 16:47:41 +01:00
globals . enableBrowserIntegrationFingerprint = value ;
await this . saveGlobals (
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEnableCloseToTray ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
2022-01-20 15:03:31 +01:00
( await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . enableCloseToTray ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEnableCloseToTray ( value : boolean , options? : StorageOptions ) : Promise < void > {
2022-01-20 15:03:31 +01:00
const globals = await this . getGlobals (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
2022-01-20 15:03:31 +01:00
globals . enableCloseToTray = value ;
await this . saveGlobals (
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEnableFullWidth ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
(
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
)
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
) ? . settings ? . enableFullWidth ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEnableFullWidth ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . enableFullWidth = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEnableGravitars ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
(
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
)
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
) ? . settings ? . enableGravitars ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEnableGravitars ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . enableGravitars = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEnableMinimizeToTray ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
2022-01-20 15:03:31 +01:00
( await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . enableMinimizeToTray ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEnableMinimizeToTray ( value : boolean , options? : StorageOptions ) : Promise < void > {
2022-01-20 15:03:31 +01:00
const globals = await this . getGlobals (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
2022-01-20 15:03:31 +01:00
globals . enableMinimizeToTray = value ;
await this . saveGlobals (
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEnableStartToTray ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
2022-01-20 15:03:31 +01:00
( await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . enableStartToTray ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEnableStartToTray ( value : boolean , options? : StorageOptions ) : Promise < void > {
2022-01-20 15:03:31 +01:00
const globals = await this . getGlobals (
2021-12-15 04:04:39 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
2022-01-20 15:03:31 +01:00
globals . enableStartToTray = value ;
await this . saveGlobals (
globals ,
2021-12-15 04:04:39 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEnableTray ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
2022-01-20 15:03:31 +01:00
( await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . enableTray ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEnableTray ( value : boolean , options? : StorageOptions ) : Promise < void > {
2022-01-20 15:03:31 +01:00
const globals = await this . getGlobals (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
2022-01-20 15:03:31 +01:00
globals . enableTray = value ;
await this . saveGlobals (
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEncryptedCiphers ( options? : StorageOptions ) : Promise < { [ id : string ] : CipherData } > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) ) )
) ? . data ? . ciphers ? . encrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEncryptedCiphers (
value : { [ id : string ] : CipherData } ,
options? : StorageOptions
) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . ciphers . encrypted = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEncryptedCollections (
options? : StorageOptions
) : Promise < { [ id : string ] : CollectionData } > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) ) )
) ? . data ? . collections ? . encrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEncryptedCollections (
value : { [ id : string ] : CollectionData } ,
options? : StorageOptions
) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . collections . encrypted = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEncryptedCryptoSymmetricKey ( options? : StorageOptions ) : Promise < string > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . keys . cryptoSymmetricKey . encrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEncryptedCryptoSymmetricKey ( value : string , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . keys . cryptoSymmetricKey . encrypted = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEncryptedFolders ( options? : StorageOptions ) : Promise < { [ id : string ] : FolderData } > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) ) )
) ? . data ? . folders ? . encrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEncryptedFolders (
value : { [ id : string ] : FolderData } ,
options? : StorageOptions
) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . folders . encrypted = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEncryptedOrganizationKeys ( options? : StorageOptions ) : Promise < any > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . keys ? . organizationKeys . encrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEncryptedOrganizationKeys (
value : Map < string , SymmetricCryptoKey > ,
options? : StorageOptions
) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . keys . organizationKeys . encrypted = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEncryptedPasswordGenerationHistory (
options? : StorageOptions
) : Promise < GeneratedPasswordHistory [ ] > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . data ? . passwordGenerationHistory ? . encrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEncryptedPasswordGenerationHistory (
value : GeneratedPasswordHistory [ ] ,
options? : StorageOptions
) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . passwordGenerationHistory . encrypted = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEncryptedPinProtected ( options? : StorageOptions ) : Promise < string > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . settings ? . pinProtected ? . encrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEncryptedPinProtected ( value : string , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . pinProtected . encrypted = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEncryptedPolicies ( options? : StorageOptions ) : Promise < { [ id : string ] : PolicyData } > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . data ? . policies ? . encrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEncryptedPolicies (
value : { [ id : string ] : PolicyData } ,
options? : StorageOptions
) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . policies . encrypted = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEncryptedPrivateKey ( options? : StorageOptions ) : Promise < string > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . keys ? . privateKey ? . encrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEncryptedPrivateKey ( value : string , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . keys . privateKey . encrypted = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEncryptedProviderKeys ( options? : StorageOptions ) : Promise < any > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . keys ? . providerKeys ? . encrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEncryptedProviderKeys ( value : any , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . keys . providerKeys . encrypted = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEncryptedSends ( options? : StorageOptions ) : Promise < { [ id : string ] : SendData } > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) ) )
) ? . data ? . sends . encrypted ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEncryptedSends (
value : { [ id : string ] : SendData } ,
options? : StorageOptions
) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . sends . encrypted = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEntityId ( options? : StorageOptions ) : Promise < string > {
2021-12-20 14:48:47 +01:00
return (
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) ) )
) ? . profile ? . entityId ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEntityId ( value : string , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
2021-12-20 14:48:47 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . profile . entityId = value ;
2021-12-20 14:48:47 +01:00
await this . saveAccount (
account ,
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEntityType ( options? : StorageOptions ) : Promise < any > {
2021-12-20 14:48:47 +01:00
return (
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) ) )
) ? . profile ? . entityType ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEntityType ( value : string , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
2021-12-20 14:48:47 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . profile . entityType = value ;
2021-12-20 14:48:47 +01:00
await this . saveAccount (
account ,
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
) ;
2021-12-16 13:36:21 +01:00
}
2022-01-10 18:25:38 +01:00
async getEnvironmentUrls ( options? : StorageOptions ) : Promise < EnvironmentUrls > {
2022-01-07 15:30:54 +01:00
if ( this . state . activeUserId == null ) {
2022-01-10 18:25:38 +01:00
return await this . getGlobalEnvironmentUrls ( options ) ;
2022-01-07 15:30:54 +01:00
}
2022-01-10 18:25:38 +01:00
options = this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ;
2022-01-07 15:30:54 +01:00
return ( await this . getAccount ( options ) ) ? . settings ? . environmentUrls ? ? new EnvironmentUrls ( ) ;
2021-12-16 13:36:21 +01:00
}
2022-01-10 18:25:38 +01:00
async setEnvironmentUrls ( value : EnvironmentUrls , options? : StorageOptions ) : Promise < void > {
2022-01-07 15:30:54 +01:00
// Global values are set on each change and the current global settings are passed to any newly authed accounts.
// This is to allow setting environement values before an account is active, while still allowing individual accounts to have their own environments.
2021-12-20 14:48:47 +01:00
const globals = await this . getGlobals (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
2021-12-20 14:48:47 +01:00
globals . environmentUrls = value ;
await this . saveGlobals (
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEquivalentDomains ( options? : StorageOptions ) : Promise < any > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . settings ? . equivalentDomains ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEquivalentDomains ( value : string , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . equivalentDomains = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEventCollection ( options? : StorageOptions ) : Promise < EventData [ ] > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . data ? . eventCollection ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEventCollection ( value : EventData [ ] , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . eventCollection = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getEverBeenUnlocked ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
2022-02-11 05:46:42 +01:00
( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ) ? . profile
? . everBeenUnlocked ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setEverBeenUnlocked ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
2022-02-11 05:46:42 +01:00
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . profile . everBeenUnlocked = value ;
2022-02-11 05:46:42 +01:00
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getForcePasswordReset ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ) ? . profile
? . forcePasswordReset ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setForcePasswordReset ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . profile . forcePasswordReset = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getInstalledVersion ( options? : StorageOptions ) : Promise < string > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . installedVersion ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setInstalledVersion ( value : string , options? : StorageOptions ) : Promise < void > {
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . installedVersion = value ;
await this . saveGlobals (
2021-12-16 13:36:21 +01:00
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getIsAuthenticated ( options? : StorageOptions ) : Promise < boolean > {
return ( await this . getAccessToken ( options ) ) != null && ( await this . getUserId ( options ) ) != null ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getKdfIterations ( options? : StorageOptions ) : Promise < number > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . profile ? . kdfIterations ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setKdfIterations ( value : number , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . profile . kdfIterations = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getKdfType ( options? : StorageOptions ) : Promise < KdfType > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . profile ? . kdfType ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setKdfType ( value : KdfType , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . profile . kdfType = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getKeyHash ( options? : StorageOptions ) : Promise < string > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . profile ? . keyHash ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setKeyHash ( value : string , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . profile . keyHash = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getLastActive ( options? : StorageOptions ) : Promise < number > {
2022-02-07 17:36:53 +01:00
options = this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ;
const accountActivity = await this . storageService . get < { [ userId : string ] : number } > (
keys . accountActivity ,
options
) ;
if ( accountActivity == null || Object . keys ( accountActivity ) . length < 1 ) {
return null ;
}
return accountActivity [ options . userId ] ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setLastActive ( value : number , options? : StorageOptions ) : Promise < void > {
2022-02-07 17:36:53 +01:00
options = this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ;
if ( options . userId == null ) {
return ;
2021-12-16 13:36:21 +01:00
}
2022-02-07 17:36:53 +01:00
const accountActivity =
( await this . storageService . get < { [ userId : string ] : number } > (
keys . accountActivity ,
options
) ) ? ? { } ;
accountActivity [ options . userId ] = value ;
await this . storageService . save ( keys . accountActivity , accountActivity , options ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getLastSync ( options? : StorageOptions ) : Promise < string > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) ) )
) ? . profile ? . lastSync ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setLastSync ( value : string , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . profile . lastSync = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getLegacyEtmKey ( options? : StorageOptions ) : Promise < SymmetricCryptoKey > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . keys ? . legacyEtmKey ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setLegacyEtmKey ( value : SymmetricCryptoKey , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . keys . legacyEtmKey = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getLocalData ( options? : StorageOptions ) : Promise < any > {
2022-02-14 22:32:55 +01:00
return (
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) ) )
) ? . data ? . localData ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setLocalData ( value : string , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
2022-02-14 22:32:55 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . localData = value ;
2022-02-14 22:32:55 +01:00
await this . saveAccount (
account ,
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getLocale ( options? : StorageOptions ) : Promise < string > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) ) )
) ? . locale ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setLocale ( value : string , options? : StorageOptions ) : Promise < void > {
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . locale = value ;
await this . saveGlobals (
2021-12-16 13:36:21 +01:00
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getLoginRedirect ( options? : StorageOptions ) : Promise < any > {
return ( await this . getGlobals ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . loginRedirect ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setLoginRedirect ( value : any , options? : StorageOptions ) : Promise < void > {
const globals = await this . getGlobals (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . loginRedirect = value ;
await this . saveGlobals ( globals , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getMainWindowSize ( options? : StorageOptions ) : Promise < number > {
return ( await this . getGlobals ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . mainWindowSize ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setMainWindowSize ( value : number , options? : StorageOptions ) : Promise < void > {
const globals = await this . getGlobals (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . mainWindowSize = value ;
await this . saveGlobals ( globals , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getMinimizeOnCopyToClipboard ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . settings ? . minimizeOnCopyToClipboard ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setMinimizeOnCopyToClipboard ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . minimizeOnCopyToClipboard = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getNeverDomains ( options? : StorageOptions ) : Promise < { [ id : string ] : any } > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . settings ? . neverDomains ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setNeverDomains ( value : { [ id : string ] : any } , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . neverDomains = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getNoAutoPromptBiometrics ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . noAutoPromptBiometrics ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setNoAutoPromptBiometrics ( value : boolean , options? : StorageOptions ) : Promise < void > {
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . noAutoPromptBiometrics = value ;
await this . saveGlobals (
2021-12-16 13:36:21 +01:00
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getNoAutoPromptBiometricsText ( options? : StorageOptions ) : Promise < string > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . noAutoPromptBiometricsText ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setNoAutoPromptBiometricsText ( value : string , options? : StorageOptions ) : Promise < void > {
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . noAutoPromptBiometricsText = value ;
await this . saveGlobals (
2021-12-16 13:36:21 +01:00
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getOpenAtLogin ( options? : StorageOptions ) : Promise < boolean > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
( await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ) )
? . openAtLogin ? ? false
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setOpenAtLogin ( value : boolean , options? : StorageOptions ) : Promise < void > {
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . openAtLogin = value ;
await this . saveGlobals (
2021-12-16 13:36:21 +01:00
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getOrganizationInvitation ( options? : StorageOptions ) : Promise < any > {
return ( await this . getGlobals ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . organizationInvitation ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setOrganizationInvitation ( value : any , options? : StorageOptions ) : Promise < void > {
const globals = await this . getGlobals (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . organizationInvitation = value ;
await this . saveGlobals ( globals , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getOrganizations ( options? : StorageOptions ) : Promise < { [ id : string ] : OrganizationData } > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
2021-12-15 04:04:39 +01:00
) ? . data ? . organizations ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setOrganizations (
value : { [ id : string ] : OrganizationData } ,
options? : StorageOptions
) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . organizations = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getPasswordGenerationOptions ( options? : StorageOptions ) : Promise < any > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . settings ? . passwordGenerationOptions ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setPasswordGenerationOptions ( value : any , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . passwordGenerationOptions = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getProtectedPin ( options? : StorageOptions ) : Promise < string > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . settings ? . protectedPin ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setProtectedPin ( value : string , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . protectedPin = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getProviders ( options? : StorageOptions ) : Promise < { [ id : string ] : ProviderData } > {
2022-02-10 19:55:36 +01:00
return (
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . data ? . providers ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setProviders (
value : { [ id : string ] : ProviderData } ,
options? : StorageOptions
) : Promise < void > {
const account = await this . getAccount (
2022-02-10 19:55:36 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . data . providers = value ;
2022-02-10 19:55:36 +01:00
await this . saveAccount (
account ,
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getPublicKey ( options? : StorageOptions ) : Promise < ArrayBuffer > {
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . keys ? . publicKey ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setPublicKey ( value : ArrayBuffer , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . keys . publicKey = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getRefreshToken ( options? : StorageOptions ) : Promise < string > {
2022-02-11 15:38:00 +01:00
options = await this . getTimeoutBasedStorageOptions ( options ) ;
2022-02-09 23:01:43 +01:00
return ( await this . getAccount ( options ) ) ? . tokens ? . refreshToken ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setRefreshToken ( value : string , options? : StorageOptions ) : Promise < void > {
2022-02-11 15:38:00 +01:00
options = await this . getTimeoutBasedStorageOptions ( options ) ;
2022-02-09 23:01:43 +01:00
const account = await this . getAccount ( options ) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . tokens . refreshToken = value ;
2022-02-09 23:01:43 +01:00
await this . saveAccount ( account , options ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getRememberedEmail ( options? : StorageOptions ) : Promise < string > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) ) )
) ? . rememberedEmail ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setRememberedEmail ( value : string , options? : StorageOptions ) : Promise < void > {
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . rememberedEmail = value ;
await this . saveGlobals (
2021-12-16 13:36:21 +01:00
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getSecurityStamp ( options? : StorageOptions ) : Promise < string > {
return ( await this . getAccount ( this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) )
? . tokens ? . securityStamp ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setSecurityStamp ( value : string , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , this . defaultInMemoryOptions )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . tokens . securityStamp = value ;
await this . saveAccount ( account , this . reconcileOptions ( options , this . defaultInMemoryOptions ) ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getSettings ( options? : StorageOptions ) : Promise < any > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) ) )
) ? . settings ? . settings ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setSettings ( value : string , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . settings = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskMemoryOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getSsoCodeVerifier ( options? : StorageOptions ) : Promise < string > {
2021-12-17 17:24:38 +01:00
return (
await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . ssoCodeVerifier ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setSsoCodeVerifier ( value : string , options? : StorageOptions ) : Promise < void > {
2021-12-17 17:24:38 +01:00
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
) ;
globals . ssoCodeVerifier = value ;
await this . saveGlobals (
globals ,
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getSsoOrgIdentifier ( options? : StorageOptions ) : Promise < string > {
2021-12-16 13:36:21 +01:00
return (
2021-12-17 17:24:38 +01:00
await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) ) )
) ? . ssoOrganizationIdentifier ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setSsoOrganizationIdentifier ( value : string , options? : StorageOptions ) : Promise < void > {
2021-12-17 17:24:38 +01:00
const globals = await this . getGlobals (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
2021-12-17 17:24:38 +01:00
globals . ssoOrganizationIdentifier = value ;
await this . saveGlobals (
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getSsoState ( options? : StorageOptions ) : Promise < string > {
2021-12-17 17:24:38 +01:00
return (
await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . ssoState ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setSsoState ( value : string , options? : StorageOptions ) : Promise < void > {
2021-12-17 17:24:38 +01:00
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
) ;
globals . ssoState = value ;
await this . saveGlobals (
globals ,
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
) ;
2021-12-16 13:36:21 +01:00
}
2022-01-28 11:28:36 +01:00
async getTheme ( options? : StorageOptions ) : Promise < ThemeType > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) ) )
2021-12-16 13:36:21 +01:00
) ? . theme ;
}
2022-01-28 11:28:36 +01:00
async setTheme ( value : ThemeType , options? : StorageOptions ) : Promise < void > {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . theme = value ;
await this . saveGlobals (
2021-12-16 13:36:21 +01:00
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getTwoFactorToken ( options? : StorageOptions ) : Promise < string > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) ) )
) ? . twoFactorToken ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setTwoFactorToken ( value : string , options? : StorageOptions ) : Promise < void > {
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . twoFactorToken = value ;
await this . saveGlobals (
2021-12-16 13:36:21 +01:00
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getUserId ( options? : StorageOptions ) : Promise < string > {
2021-12-16 13:36:21 +01:00
return (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . profile ? . userId ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getUsesKeyConnector ( options? : StorageOptions ) : Promise < boolean > {
2022-01-20 10:32:44 +01:00
return (
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) )
) ? . profile ? . usesKeyConnector ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setUsesKeyConnector ( value : boolean , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
2022-01-20 10:32:44 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . profile . usesKeyConnector = value ;
2022-01-20 10:32:44 +01:00
await this . saveAccount (
account ,
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getVaultTimeout ( options? : StorageOptions ) : Promise < number > {
const accountVaultTimeout = (
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) ) )
) ? . settings ? . vaultTimeout ;
2021-12-20 14:48:47 +01:00
return accountVaultTimeout ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setVaultTimeout ( value : number , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . vaultTimeout = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getVaultTimeoutAction ( options? : StorageOptions ) : Promise < string > {
const accountVaultTimeoutAction = (
await this . getAccount ( this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) ) )
) ? . settings ? . vaultTimeoutAction ;
const globalVaultTimeoutAction = (
await this . getGlobals ( this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) ) )
) ? . vaultTimeoutAction ;
return accountVaultTimeoutAction ? ? globalVaultTimeoutAction ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setVaultTimeoutAction ( value : string , options? : StorageOptions ) : Promise < void > {
const account = await this . getAccount (
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
account . settings . vaultTimeoutAction = value ;
await this . saveAccount (
2021-12-16 13:36:21 +01:00
account ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskLocalOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async getStateVersion ( ) : Promise < number > {
return ( await this . getGlobals ( await this . defaultOnDiskLocalOptions ( ) ) ) . stateVersion ? ? 1 ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
async setStateVersion ( value : number ) : Promise < void > {
const globals = await this . getGlobals ( await this . defaultOnDiskOptions ( ) ) ;
globals . stateVersion = value ;
await this . saveGlobals ( globals , await this . defaultOnDiskOptions ( ) ) ;
2021-12-16 13:36:21 +01:00
}
2022-01-27 16:44:09 +01:00
async getWindow ( ) : Promise < WindowState > {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
const globals = await this . getGlobals ( await this . defaultOnDiskOptions ( ) ) ;
return globals ? . window != null && Object . keys ( globals . window ) . length > 0
? globals . window
2022-01-27 16:44:09 +01:00
: new WindowState ( ) ;
2021-12-16 13:36:21 +01:00
}
2022-01-27 16:44:09 +01:00
async setWindow ( value : WindowState , options? : StorageOptions ) : Promise < void > {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
const globals = await this . getGlobals (
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
globals . window = value ;
return await this . saveGlobals (
2021-12-16 13:36:21 +01:00
globals ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) )
2021-12-16 13:36:21 +01:00
) ;
}
2022-01-31 20:33:31 +01:00
protected async getGlobals ( options : StorageOptions ) : Promise < TGlobalState > {
let globals : TGlobalState ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
if ( this . useMemory ( options . storageLocation ) ) {
globals = this . getGlobalsFromMemory ( ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
if ( this . useDisk && globals == null ) {
globals = await this . getGlobalsFromDisk ( options ) ;
2021-12-16 13:36:21 +01:00
}
2022-01-31 20:33:31 +01:00
return globals ? ? this . createGlobals ( ) ;
2021-12-16 13:36:21 +01:00
}
2022-01-31 20:33:31 +01:00
protected async saveGlobals ( globals : TGlobalState , options : StorageOptions ) {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
return this . useMemory ( options . storageLocation )
? this . saveGlobalsToMemory ( globals )
: await this . saveGlobalsToDisk ( globals , options ) ;
2021-12-16 13:36:21 +01:00
}
2022-01-31 20:33:31 +01:00
protected getGlobalsFromMemory ( ) : TGlobalState {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
return this . state . globals ;
2021-12-16 13:36:21 +01:00
}
2022-01-31 20:33:31 +01:00
protected async getGlobalsFromDisk ( options : StorageOptions ) : Promise < TGlobalState > {
return await this . storageService . get < TGlobalState > ( keys . global , options ) ;
2021-12-16 13:36:21 +01:00
}
2022-01-31 20:33:31 +01:00
protected saveGlobalsToMemory ( globals : TGlobalState ) : void {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . state . globals = globals ;
2021-12-16 13:36:21 +01:00
}
2022-01-31 20:33:31 +01:00
protected async saveGlobalsToDisk ( globals : TGlobalState , options : StorageOptions ) : Promise < void > {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
if ( options . useSecureStorage ) {
2022-01-19 16:51:10 +01:00
await this . secureStorageService . save ( keys . global , globals , options ) ;
2021-12-16 13:36:21 +01:00
} else {
2022-01-19 16:51:10 +01:00
await this . storageService . save ( keys . global , globals , options ) ;
2021-12-16 13:36:21 +01:00
}
}
2021-12-20 14:48:47 +01:00
protected async getAccount ( options : StorageOptions ) : Promise < TAccount > {
2021-12-16 13:36:21 +01:00
try {
2021-12-20 14:48:47 +01:00
let account : TAccount ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
if ( this . useMemory ( options . storageLocation ) ) {
account = this . getAccountFromMemory ( options ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
if ( this . useDisk ( options . storageLocation ) && account == null ) {
account = await this . getAccountFromDisk ( options ) ;
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
return account ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
} catch ( e ) {
this . logService . error ( e ) ;
2021-12-16 13:36:21 +01:00
}
}
2021-12-20 14:48:47 +01:00
protected getAccountFromMemory ( options : StorageOptions ) : TAccount {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
if ( this . state . accounts == null ) {
return null ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
return this . state . accounts [ this . getUserIdFromMemory ( options ) ] ;
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
protected getUserIdFromMemory ( options : StorageOptions ) : string {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
return options ? . userId != null
? this . state . accounts [ options . userId ] ? . profile ? . userId
: this . state . activeUserId ;
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
protected async getAccountFromDisk ( options : StorageOptions ) : Promise < TAccount > {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
if ( options ? . userId == null && this . state . activeUserId == null ) {
return null ;
2021-12-16 13:36:21 +01:00
}
2022-02-14 17:47:01 +01:00
if ( this . useAccountCache ) {
const cachedAccount = this . accountDiskCache . get ( options . userId ) ;
if ( cachedAccount != null ) {
return cachedAccount ;
}
2022-02-11 06:20:50 +01:00
}
2022-01-19 16:51:10 +01:00
const account = options ? . useSecureStorage
? ( await this . secureStorageService . get < TAccount > ( options . userId , options ) ) ? ?
( await this . storageService . get < TAccount > (
options . userId ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . reconcileOptions ( options , { htmlStorageLocation : HtmlStorageLocation.Local } )
2021-12-16 13:36:21 +01:00
) )
2022-01-19 16:51:10 +01:00
: await this . storageService . get < TAccount > ( options . userId , options ) ;
2021-12-16 13:36:21 +01:00
2022-02-14 17:47:01 +01:00
if ( this . useAccountCache ) {
this . accountDiskCache . set ( options . userId , account ) ;
}
2022-01-19 16:51:10 +01:00
return account ;
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
protected useMemory ( storageLocation : StorageLocation ) {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
return storageLocation === StorageLocation . Memory || storageLocation === StorageLocation . Both ;
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
protected useDisk ( storageLocation : StorageLocation ) {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
return storageLocation === StorageLocation . Disk || storageLocation === StorageLocation . Both ;
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
protected async saveAccount (
account : TAccount ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
options : StorageOptions = {
storageLocation : StorageLocation.Both ,
useSecureStorage : false ,
2021-12-16 13:36:21 +01:00
}
) {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
return this . useMemory ( options . storageLocation )
? await this . saveAccountToMemory ( account )
: await this . saveAccountToDisk ( account , options ) ;
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
protected async saveAccountToDisk ( account : TAccount , options : StorageOptions ) : Promise < void > {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
const storageLocation = options . useSecureStorage
? this . secureStorageService
: this . storageService ;
2021-12-16 13:36:21 +01:00
2022-01-19 16:51:10 +01:00
await storageLocation . save ( ` ${ options . userId } ` , account , options ) ;
2022-02-14 17:47:01 +01:00
if ( this . useAccountCache ) {
this . accountDiskCache . delete ( options . userId ) ;
}
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
protected async saveAccountToMemory ( account : TAccount ) : Promise < void > {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
if ( this . getAccountFromMemory ( { userId : account.profile.userId } ) !== null ) {
this . state . accounts [ account . profile . userId ] = account ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . pushAccounts ( ) ;
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
protected async scaffoldNewAccountStorage ( account : TAccount ) : Promise < void > {
2022-02-09 23:01:43 +01:00
// We don't want to manipulate the referenced in memory account
const deepClone = JSON . parse ( JSON . stringify ( account ) ) ;
await this . scaffoldNewAccountLocalStorage ( deepClone ) ;
await this . scaffoldNewAccountSessionStorage ( deepClone ) ;
await this . scaffoldNewAccountMemoryStorage ( deepClone ) ;
2021-12-16 13:36:21 +01:00
}
2022-01-19 16:51:10 +01:00
// TODO: There is a tech debt item for splitting up these methods - only Web uses multiple storage locations in its storageService.
// For now these methods exist with some redundancy to facilitate this special web requirement.
2021-12-20 14:48:47 +01:00
protected async scaffoldNewAccountLocalStorage ( account : TAccount ) : Promise < void > {
2022-02-11 18:45:48 +01:00
const storedAccount = await this . getAccount (
this . reconcileOptions (
{ userId : account.profile.userId } ,
await this . defaultOnDiskLocalOptions ( )
)
2022-01-19 16:51:10 +01:00
) ;
2022-01-21 17:14:34 +01:00
// EnvironmentUrls are set before authenticating and should override whatever is stored from any previous session
const environmentUrls = account . settings . environmentUrls ;
2022-01-19 16:51:10 +01:00
if ( storedAccount ? . settings != null ) {
2021-12-20 14:48:47 +01:00
account . settings = storedAccount . settings ;
2022-01-20 14:30:00 +01:00
} else if ( await this . storageService . has ( keys . tempAccountSettings ) ) {
account . settings = await this . storageService . get < any > ( keys . tempAccountSettings ) ;
await this . storageService . remove ( keys . tempAccountSettings ) ;
2021-12-16 13:36:21 +01:00
}
2022-01-21 19:35:14 +01:00
account . settings . environmentUrls = environmentUrls ;
2022-02-11 15:38:00 +01:00
if ( account . settings . vaultTimeoutAction === "logOut" && account . settings . vaultTimeout != null ) {
2022-02-09 23:01:43 +01:00
account . tokens . accessToken = null ;
account . tokens . refreshToken = null ;
account . profile . apiKeyClientId = null ;
account . keys . apiKeyClientSecret = null ;
}
2022-02-11 18:45:48 +01:00
await this . saveAccount (
account ,
this . reconcileOptions (
{ userId : account.profile.userId } ,
await this . defaultOnDiskLocalOptions ( )
)
) ;
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
protected async scaffoldNewAccountMemoryStorage ( account : TAccount ) : Promise < void > {
2022-02-11 18:45:48 +01:00
const storedAccount = await this . getAccount (
this . reconcileOptions (
{ userId : account.profile.userId } ,
await this . defaultOnDiskMemoryOptions ( )
)
2022-01-19 16:51:10 +01:00
) ;
if ( storedAccount ? . settings != null ) {
storedAccount . settings . environmentUrls = account . settings . environmentUrls ;
2021-12-20 14:48:47 +01:00
account . settings = storedAccount . settings ;
2021-12-16 13:36:21 +01:00
}
2022-02-11 18:45:48 +01:00
await this . storageService . save (
account . profile . userId ,
account ,
await this . defaultOnDiskMemoryOptions ( )
) ;
await this . saveAccount (
account ,
this . reconcileOptions (
{ userId : account.profile.userId } ,
await this . defaultOnDiskMemoryOptions ( )
)
) ;
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
protected async scaffoldNewAccountSessionStorage ( account : TAccount ) : Promise < void > {
2022-02-11 18:45:48 +01:00
const storedAccount = await this . getAccount (
this . reconcileOptions ( { userId : account.profile.userId } , await this . defaultOnDiskOptions ( ) )
2022-01-19 16:51:10 +01:00
) ;
if ( storedAccount ? . settings != null ) {
storedAccount . settings . environmentUrls = account . settings . environmentUrls ;
2021-12-20 14:48:47 +01:00
account . settings = storedAccount . settings ;
2021-12-16 13:36:21 +01:00
}
2022-02-11 18:45:48 +01:00
await this . storageService . save (
account . profile . userId ,
account ,
await this . defaultOnDiskMemoryOptions ( )
) ;
await this . saveAccount (
account ,
this . reconcileOptions ( { userId : account.profile.userId } , await this . defaultOnDiskOptions ( ) )
) ;
2021-12-16 13:36:21 +01:00
}
2022-01-19 16:51:10 +01:00
//
2021-12-16 13:36:21 +01:00
2021-12-20 14:48:47 +01:00
protected async pushAccounts ( ) : Promise < void > {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
await this . pruneInMemoryAccounts ( ) ;
if ( this . state ? . accounts == null || Object . keys ( this . state . accounts ) . length < 1 ) {
this . accounts . next ( null ) ;
2021-12-16 13:36:21 +01:00
return ;
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
this . accounts . next ( this . state . accounts ) ;
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
protected reconcileOptions (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
requestedOptions : StorageOptions ,
defaultOptions : StorageOptions
) : StorageOptions {
if ( requestedOptions == null ) {
return defaultOptions ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
requestedOptions . userId = requestedOptions ? . userId ? ? defaultOptions . userId ;
requestedOptions . storageLocation =
requestedOptions ? . storageLocation ? ? defaultOptions . storageLocation ;
requestedOptions . useSecureStorage =
requestedOptions ? . useSecureStorage ? ? defaultOptions . useSecureStorage ;
requestedOptions . htmlStorageLocation =
requestedOptions ? . htmlStorageLocation ? ? defaultOptions . htmlStorageLocation ;
requestedOptions . keySuffix = requestedOptions ? . keySuffix ? ? defaultOptions . keySuffix ;
return requestedOptions ;
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
protected get defaultInMemoryOptions ( ) : StorageOptions {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
return { storageLocation : StorageLocation.Memory , userId : this.state.activeUserId } ;
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
protected async defaultOnDiskOptions ( ) : Promise < StorageOptions > {
2021-12-16 13:36:21 +01:00
return {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
storageLocation : StorageLocation.Disk ,
htmlStorageLocation : HtmlStorageLocation.Session ,
2022-01-07 15:30:54 +01:00
userId : this.state.activeUserId ? ? ( await this . getActiveUserIdFromStorage ( ) ) ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
useSecureStorage : false ,
2021-12-16 13:36:21 +01:00
} ;
}
2021-12-20 14:48:47 +01:00
protected async defaultOnDiskLocalOptions ( ) : Promise < StorageOptions > {
2021-12-16 13:36:21 +01:00
return {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
storageLocation : StorageLocation.Disk ,
htmlStorageLocation : HtmlStorageLocation.Local ,
2022-01-07 15:30:54 +01:00
userId : this.state.activeUserId ? ? ( await this . getActiveUserIdFromStorage ( ) ) ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
useSecureStorage : false ,
2021-12-16 13:36:21 +01:00
} ;
}
2021-12-20 14:48:47 +01:00
protected async defaultOnDiskMemoryOptions ( ) : Promise < StorageOptions > {
2021-12-16 13:36:21 +01:00
return {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
storageLocation : StorageLocation.Disk ,
htmlStorageLocation : HtmlStorageLocation.Memory ,
2022-01-07 15:30:54 +01:00
userId : this.state.activeUserId ? ? ( await this . getUserId ( ) ) ,
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
useSecureStorage : false ,
2021-12-16 13:36:21 +01:00
} ;
}
2021-12-20 14:48:47 +01:00
protected async defaultSecureStorageOptions ( ) : Promise < StorageOptions > {
2021-12-16 13:36:21 +01:00
return {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
storageLocation : StorageLocation.Disk ,
useSecureStorage : true ,
2022-01-07 15:30:54 +01:00
userId : this.state.activeUserId ? ? ( await this . getActiveUserIdFromStorage ( ) ) ,
2021-12-16 13:36:21 +01:00
} ;
}
2021-12-20 14:48:47 +01:00
protected async getActiveUserIdFromStorage ( ) : Promise < string > {
2022-01-19 16:51:10 +01:00
return await this . storageService . get < string > ( keys . activeUserId ) ;
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
protected async removeAccountFromLocalStorage (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
userId : string = this . state . activeUserId
) : Promise < void > {
2022-02-11 21:11:31 +01:00
const storedAccount = await this . getAccount (
this . reconcileOptions ( { userId : userId } , await this . defaultOnDiskLocalOptions ( ) )
) ;
await this . saveAccount (
2022-01-19 16:51:10 +01:00
this . resetAccount ( storedAccount ) ,
2022-02-11 21:11:31 +01:00
this . reconcileOptions ( { userId : userId } , await this . defaultOnDiskLocalOptions ( ) )
2022-01-19 16:51:10 +01:00
) ;
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
protected async removeAccountFromSessionStorage (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
userId : string = this . state . activeUserId
) : Promise < void > {
2022-02-11 21:11:31 +01:00
const storedAccount = await this . getAccount (
this . reconcileOptions ( { userId : userId } , await this . defaultOnDiskOptions ( ) )
) ;
await this . saveAccount (
2022-01-19 16:51:10 +01:00
this . resetAccount ( storedAccount ) ,
2022-02-11 21:11:31 +01:00
this . reconcileOptions ( { userId : userId } , await this . defaultOnDiskOptions ( ) )
2022-01-19 16:51:10 +01:00
) ;
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
}
2021-12-16 13:36:21 +01:00
2021-12-20 14:48:47 +01:00
protected async removeAccountFromSecureStorage (
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
userId : string = this . state . activeUserId
) : Promise < void > {
await this . setCryptoMasterKeyAuto ( null , { userId : userId } ) ;
await this . setCryptoMasterKeyBiometric ( null , { userId : userId } ) ;
await this . setCryptoMasterKeyB64 ( null , { userId : userId } ) ;
}
2021-12-16 13:36:21 +01:00
2021-12-20 14:48:47 +01:00
protected removeAccountFromMemory ( userId : string = this . state . activeUserId ) : void {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
delete this . state . accounts [ userId ] ;
2022-02-14 17:47:01 +01:00
if ( this . useAccountCache ) {
this . accountDiskCache . delete ( userId ) ;
}
2021-12-16 13:36:21 +01:00
}
2021-12-20 14:48:47 +01:00
protected async pruneInMemoryAccounts() {
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
// We preserve settings for logged out accounts, but we don't want to consider them when thinking about active account state
for ( const userId in this . state . accounts ) {
if ( ! ( await this . getIsAuthenticated ( { userId : userId } ) ) ) {
2022-02-11 14:06:40 +01:00
this . removeAccountFromMemory ( userId ) ;
2021-12-16 13:36:21 +01:00
}
[Account Switching] [Feature] Allow clients to store data for more than one user (#491)
* [refactor] Extract, rename, and expand StorageServiceOptions
* Pulled StorageServiceOptions into its own file
* Renamed StorageServiceOptions to StorageOptions
* Pulled KeySuffixOpptions into its own file
* Converted KeySuffixOptions into an enum from a union type
* [refactor] Expand StateService into a full coverage storage proxy
* Expand StateService to allow it to manage all data points of the application state regardless of memory.
* Expand StateService to allow for storing and managing multiple accounts
* [refactor] Create helper services for managing organization and provider state data
* [refactor] Implement StateService across service layer
* Remove service level variables used for in memory data storage and replaced with calls to StateService
* Remove direct calls to StorageService in favor of using StateService as a proxy
* [feature] Implement account switching capable services across components and processes
* Replace calls to StorageService and deprecated services with calls to a StateService
* [chore] Remove unused services
Several services are no longer in use because of the expanded state service. These have simply been removed.
* [bug] Add loginRedirect to the account model
* [bug] Add awaits to newly async calls in TokenService
* [bug] Add several missing awaits
* [bug] Add state service handlers for AutoConfirmFingerprint
* [bug] Move TwoFactorToken to global state
* Update unauth-guard.service.ts
Add back return true
* [refactor] Slim down the boilerplate needed to manage options on StateService calls
* [bug] Allow the lock message handler to manipulate a specific acount
* [bug] Add missing await to auth guard
* [bug] Adjust state scope of several biometric data points
* [bug] Ensure vault locking logic can operate over non-active accounts
* [style] Fix lint complaints
* [bug] Move disableFavicon to global state
* [refactor] Remove an unecassary parameter from a StorageOptions instance
* [bug] Ensure HtmlStorageService paths are accounted for in StateService
* [feature] Add a server url helper to the account model for the account switcher
* [refactor] Remove some unused getters from the account model
* [bug] Ensure locking and logging out can function over any user
* Fix account getting set to null in getAccountFromDisk
* [bug] Ensure lock component is always working with the latest active account in state
* [chore] Update recent KeyConnector changes to use stateService
* [style] Fix lint complaints
* [chore] Resolve TokenService merge issues from KeyConnector
* [bug] Add missing service arguement
* [bug] Correct several default storage option types
* [bug] Check for the right key in hasEncKey
* [bug] Add enableFullWidth to the account model
* [style] Fix lint complaints
* [review] Revist remember email
* [refactor] Remove RememberEmail from state
* setDisableFavicon to correct storage location
* [bug] Convert vault lock loop returns into continues to not skip secondary accounts
* [review] Sorted state service methods
* [bug] Correct neverDomains type on the account model
* [review] Rename stateService.purge to stateService.clean
* [review] [refactor] Extract lock refresh logic to a load function
* [review] [refactor] Extract some timeout logic to dedicated functions
* [review] [refactor] Move AuthenticationStatus to a dedicated file
* [review] [refactor] Rename Globals to GlobalState
* [style] Fix lint complaints
* [review] Remove unused global state property for decodedToken
* [review] [bug] Adjust state scope for OrganizationInvitation
* [review] [bug] Put back the homepage variable in lock guard
* [review] Un-try-catch the window creation function
* Revert "[review] [bug] Adjust state scope for OrganizationInvitation"
This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497.
* [bug] Change || to && in recent vault timeout refactor
* [bug] Keep up with entire state in storage instead of just accounts and globals
Not having access to the last active user was creating issues across clients when restarting the process.
For example: when refreshing the page on web we no longer maintain an understanding of who is logged in.
To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals.
This allows for more flexible saving, like saving activeUserId as a top level storage item.
* [style] Fix lint complaints
* Revert "[bug] Keep up with entire state in storage instead of just accounts and globals"
This reverts commit e8970725be472386358c1e2f06f53663c4979e0e.
* [bug] Initialize GlobalState by default
* [bug] Only get key hash from storage
* [bug] Remove settings storage location overrides
* [bug] Only save accessToken to storage
* [refactor] Remove unecassary argements from electron crypto state calls
* [bug] Ensure keys and tokens load and save to the right locations for web
* [style] Fix lint complaints
* [bug] Remove keySuffix storage option and split uses into unique methods
The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state.
This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly.
* [bug] Add default vault timeouts to new accounts
* [bug] Save appId as a top level storage item
* [bug] Add missing await to timeout logic
* [bug] Adjust state scope for everBeenUnlocked
* [bug] Clear access tokens when loading account state from disk
* [bug] Adjust theme to be a global state item
* [bug] Adjust null checking for window in state
* [bug] Correct getGlobals not pulling from the stored state item
* [bug] Null check in memory account before claiming it has a userId
* [bug] Scaffold secure storage service when building storage objects on init
* [bug] Adjusted state scope of event collection
* [bug] Adjusted state scope of vault timeout and action
* [bug] Grab account from normal storage if secure storage is requested but does not exist
* [bug] Create a State if one is requested from memory before it exists
* [bug] Ensure all storage locations are cleared on state clean
* [style] Fix lint complaints
* [bug] Remove uneeded clearing of access token
* [bug] Reset tokens when toggling
* [refactor] Split up the Account model
Until this point the account model has been very flat, holding many kinds of data.
In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale,
the Account model has been divided into logical chunks.
* [bug] Correct the serverUrl helpers return
* Fix sends always coming back as empty in browser
* Get settings properly (I think)
* [bug] Fix lint error
* [bug] Add missing await to identity token refresh
This was causing weird behavior in web that was creating a lot of 429s
* [bug] Scaffold memory storage for web
Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in.
Namely, encrypted data that was recently synced had nowhere to save to and was lost.
* [bug] Implement better null handling in a few places for retrieving state
* [bug] Update correct storage locations on account removal
* [bug] Added missing awaits to lock component
* [bug] Reload lock component on account switching vs. account update
* [bug] Store master keys correctly
* [bug] Move some biometrics storage items to global state
* [feature] Add platform helper isMac()
* [refactor] Comment emphasis and call order refresh
* [refactor] Remove unecassary using
* [bug] Relocate authenticationStatus check logic to component
* [bug] Stop not clearing everything on state clean
* [style] Fix lint complaints
* [bug] Correct mismatched uses of encrypted and decrypted pin states
* Add browser specific state classes and methods
* lint fixes
* [bug] Migrate existing persistant data to new schema
* [style] Fix lint complaints
* [bug] Dont clear settings on state clean
* [bug] Maintain the right storage items on logout
* [chore] resolve issues from merge
* [bug] Resolve settings clearing on lock
* [chore] Added a comment
* [review] fromatting for code review
* Revert browser state items
Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
}
}
2021-12-20 14:48:47 +01:00
2022-01-19 16:51:10 +01:00
// settings persist even on reset, and are not effected by this method
2021-12-20 14:48:47 +01:00
protected resetAccount ( account : TAccount ) {
2022-01-19 16:51:10 +01:00
const persistentAccountInformation = { settings : account.settings } ;
return Object . assign ( this . createAccount ( ) , persistentAccountInformation ) ;
2021-12-20 14:48:47 +01:00
}
2022-01-07 15:30:54 +01:00
protected async setAccountEnvironmentUrls ( account : TAccount ) : Promise < TAccount > {
2022-01-10 18:25:38 +01:00
account . settings . environmentUrls = await this . getGlobalEnvironmentUrls ( ) ;
2022-01-07 15:30:54 +01:00
return account ;
}
2022-01-10 18:25:38 +01:00
protected async getGlobalEnvironmentUrls ( options? : StorageOptions ) : Promise < EnvironmentUrls > {
options = this . reconcileOptions ( options , await this . defaultOnDiskOptions ( ) ) ;
return ( await this . getGlobals ( options ) ) . environmentUrls ? ? new EnvironmentUrls ( ) ;
}
2022-01-19 16:51:10 +01:00
protected clearDecryptedDataForActiveUser() {
const userId = this . state . activeUserId ;
2022-02-09 23:01:43 +01:00
if ( userId == null || this . state ? . accounts [ userId ] ? . data == null ) {
2022-01-19 16:51:10 +01:00
return ;
}
this . state . accounts [ userId ] . data = new AccountData ( ) ;
}
protected createAccount ( init : Partial < TAccount > = null ) : TAccount {
2022-01-31 20:33:31 +01:00
return this . stateFactory . createAccount ( init ) ;
}
protected createGlobals ( init : Partial < TGlobalState > = null ) : TGlobalState {
return this . stateFactory . createGlobal ( init ) ;
2022-01-19 16:51:10 +01:00
}
protected async deAuthenticateAccount ( userId : string ) {
await this . setAccessToken ( null , { userId : userId } ) ;
2022-02-09 18:15:20 +01:00
await this . setLastActive ( null , { userId : userId } ) ;
2022-01-19 16:51:10 +01:00
const index = this . state . authenticatedAccounts . indexOf ( userId ) ;
if ( index > - 1 ) {
this . state . authenticatedAccounts . splice ( index , 1 ) ;
await this . storageService . save ( keys . authenticatedAccounts , this . state . authenticatedAccounts ) ;
}
}
protected async removeAccountFromDisk ( userId : string ) {
await this . removeAccountFromSessionStorage ( userId ) ;
await this . removeAccountFromLocalStorage ( userId ) ;
await this . removeAccountFromSecureStorage ( userId ) ;
}
protected async dynamicallySetActiveUser() {
2022-02-11 21:11:31 +01:00
if ( this . state . accounts == null || Object . keys ( this . state . accounts ) . length < 1 ) {
await this . setActiveUser ( null ) ;
return ;
}
2022-01-19 16:51:10 +01:00
for ( const userId in this . state . accounts ) {
if ( userId == null ) {
continue ;
}
if ( await this . getIsAuthenticated ( { userId : userId } ) ) {
await this . setActiveUser ( userId ) ;
break ;
}
await this . setActiveUser ( null ) ;
}
}
2022-02-11 15:38:00 +01:00
private async getTimeoutBasedStorageOptions ( options? : StorageOptions ) : Promise < StorageOptions > {
const timeoutAction = await this . getVaultTimeoutAction ( { userId : options?.userId } ) ;
const timeout = await this . getVaultTimeout ( { userId : options?.userId } ) ;
const defaultOptions =
timeoutAction === "logOut" && timeout != null
? this . defaultInMemoryOptions
: await this . defaultOnDiskOptions ( ) ;
return this . reconcileOptions ( options , defaultOptions ) ;
}
2018-02-12 21:06:18 +01:00
}