* move pinKeyEncryptedUserKey
* move pinKeyEncryptedUserKeyEphemeral
* remove comments, move docs
* cleanup
* use UserKeyDefinition
* refactor methods
* add migration
* fix browser dependency
* add tests for migration
* rename to pinService
* move state to PinService
* add PinService dep to CryptoService
* move protectedPin to state provider
* update service deps
* renaming
* move decryptUserKeyWithPin to pinService
* update service injection
* move more methods our of crypto service
* remove CryptoService dep from PinService and update service injection
* remove cryptoService reference
* add method to FakeMasterPasswordService
* fix circular dependency
* fix desktop service injection
* update browser dependencies
* add protectedPin to migrations
* move storePinKey to pinService
* update and clarify documentation
* more jsdoc updates
* update import paths
* refactor isPinLockSet method
* update state definitions
* initialize service before injecting into other services
* initialize service before injecting into other services (bw.ts)
* update clearOn and do additional cleanup
* clarify docs and naming
* assign abstract & private methods, add clarity to decryptAndMigrateOldPinKeyEncryptedMasterKey() method
* derived state (attempt)
* fix typos
* use accountService to get active user email
* use constant userId
* add derived state
* add get and clear for oldPinKeyEncryptedMasterKey
* require userId
* move pinProtected
* add clear methods
* remove pinProtected from account.ts and replace methods
* add methods to create and store pinKeyEncryptedUserKey
* add pinProtected/oldPinKeyEncrypterMasterKey to migration
* update migration tests
* update migration rollback tests
* update to systemService and decryptAndMigrate... method
* remove old test
* increase length of state definition name to meet test requirements
* rename 'TRANSIENT' to 'EPHEMERAL' for consistency
* fix tests for login strategies, vault-export, and fake MP service
* more updates to login-strategy tests
* write new tests for core pinKeyEncrypterUserKey methods and isPinSet
* write new tests for pinProtected and oldPinKeyEncryptedMasterKey methods
* minor test reformatting
* update test for decryptUserKeyWithPin()
* fix bug with oldPinKeyEncryptedMasterKey
* fix tests for vault-timeout-settings.service
* fix bitwarden-password-protected-importer test
* fix login strategy tests and auth-request.service test
* update pinService tests
* fix crypto service tests
* add jsdoc
* fix test file import
* update jsdocs for decryptAndMigrateOldPinKeyEncryptedMasterKey()
* update error messages and jsdocs
* add null checks, move userId retrievals
* update migration tests
* update stateService calls to require userId
* update test for decryptUserKeyWithPin()
* update oldPinKeyEncryptedMasterKey migration tests
* more test updates
* fix factory import
* update tests for isPinSet() and createProtectedPin()
* add test for makePinKey()
* add test for createPinKeyEncryptedUserKey()
* add tests for getPinLockType()
* consolidate userId verification tests
* add tests for storePinKeyEncryptedUserKey()
* fix service dep
* get email based on userId
* use MasterPasswordService instead of internal
* rename protectedPin to userKeyEncryptedPin
* rename to pinKeyEncryptedUserKeyPersistent
* update method params
* fix CryptoService tests
* jsdoc update
* use EncString for userKeyEncryptedPin
* remove comment
* use cryptoFunctionService.compareFast()
* update tests
* cleanup, remove comments
* resolve merge conflict
* fix DI of MasterPasswordService
* more DI fixes
* [AC-1707] Add feature flag
* [AC-1707] Prevent loading ciphers for provider users in the org vault when the feature flag is enabled
* [AC-1707] Ensure new canEditAllCiphers logic only applies to organizations that have FC enabled
* [AC-1707] Update editAllCiphers helper to check for restrictProviderAccess feature flag
* [AC-1707] Remove un-used vaultFilterComponent reference
* [AC-1707] Hide vault filter for providers
* [AC-1707] Add search to vault header for provider users
* [AC-1707] Hide New Item button for Providers when restrict provider access feature flag is enabled
* [AC-1707] Remove leftover debug statement
* [AC-1707] Update canEditAllCiphers references to consider the restrictProviderAccessFlag
* [AC-1707] Fix collections component changes from main
* [AC-1707] Fix some feature flag issues from merge with main
* [AC-1707] Avoid 'readonly' collection dialog for providers
* [AC-1707] Fix broken Browser component
* [AC-1707] Fix broken Desktop component
* [AC-1707] Add restrict provider flag to add access badge logic
* [AC-2555] Fix missing feature flags in CollectionsComponent
* [AC-2555] Do not filter collections when opening the cipher collections dialog in the org vault
* Ensure AuthStatus Changes Before Exiting
* Do Not Display Account Without Name Or Email
* Fix Environment Selectors
* Add AccountService.clean to Web
* Update Emergency Access To Get Their Own Key
* Migrate Organization Keys To Get Their Own Key
* Remove Optional Parameters
* Update Abstraction Parameter Name to Match Implementation
* Add @throws Doc
* Update Group modal -> Collections tab to respect collection management settings,
e.g. only allow admins to assign access to collections they can manage
* Update collectionAdminView getters for custom permissions
* [AC-1623] Remove cloneableOrganizationCiphers property
and update canClone to reflect new clone permission logic
* [AC-1623] Remove allowOwnershipAssignment override in orgVault as the same restrictions apply to both vaults
* [AC-1623] Ensure ownershipOptions are restricted for non-admins when cloning an org cipher item
* Use account service to track accounts and active account
* Remove state service active account Observables.
* Add email verified to account service
* Do not store account info on logged out accounts
* Add account activity tracking to account service
* Use last account activity from account service
* migrate or replicate account service data
* Add `AccountActivityService` that handles storing account last active data
* Move active and next active user to account service
* Remove authenticated accounts from state object
* Fold account activity into account service
* Fix builds
* Fix desktop app switch
* Fix logging out non active user
* Expand helper to handle new authenticated accounts location
* Prefer view observable to tons of async pipes
* Fix `npm run test:types`
* Correct user activity sorting test
* Be more precise about log out messaging
* Fix dev compare errors
All stored values are serializable, the next step wasn't necessary and was erroring on some types that lack `toString`.
* If the account in unlocked on load of lock component, navigate away from lock screen
* Handle no users case for auth service statuses
* Specify account to switch to
* Filter active account out of inactive accounts
* Prefer constructor init
* Improve comparator
* Use helper methods internally
* Fixup component tests
* Clarify name
* Ensure accounts object has only valid userIds
* Capitalize const values
* Prefer descriptive, single-responsibility guards
* Update libs/common/src/state-migrations/migrate.ts
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* Fix merge
* Add user Id validation
activity for undefined was being set, which was resulting in requests for the auth status of `"undefined"` (string) userId, due to key enumeration. These changes stop that at both locations, as well as account add for good measure.
---------
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* PM-7811 - Refactor UserKeyInitService to UserAutoUnlockKeyService - remove active account listening logic as it introduced race conditions with user key memory retrieval happening before the user auto unlock key was set into memory.
* PM-7811 - CLI - (1) Fix deps (2) On CLI init (pre command execution), if there is an active account, then set the user key in memory from the user auto unlock key.
* PM-7811 - Browser Extension / desktop - (1) Update deps (2) Sets user key in memory if the auto unlock key is set on account switch and background init (must act on all accounts so that account switcher displays unlock status properly).
* PM-7811 - Web - (1) Update deps (2) Sets user key in memory if the auto unlock key is set on init
* PM-7811 - Fix account switcher service changes not being necessary.
Refactors the feature flags in ConfigService to be type safe. It also moves the default value to a centralized location rather than the caller defining it. This ensures consistency across the various places they are used.
* [AC-1999] Fix null check
this.collection can be both null or unassigned and `!= null` will handle both cases.
* [AC-1999] Navigate away when selected collection is deleted
---------
Co-authored-by: bnagawiecki <107435978+bnagawiecki@users.noreply.github.com>
* PM-7235 - AuthSvc - Refactor getAuthStatus to simply use the cryptoService.hasUserKey check to determine the user's auth status.
* PM-7235 - CryptoSvc - getUserKey - remove setUserKey side effect if auto key is stored. Will move to app init
* PM-7235 - For each client init service, add setUserKeyInMemoryIfAutoUserKeySet logic
* PM-7235 - CryptoSvc tests - remove uncessary test.
* PM-7235 - Create UserKeyInitService and inject into all init services with new listening logic to support acct switching.
* PM-7235 - UserKeyInitSvc - minor refactor of setUserKeyInMemoryIfAutoUserKeySet
* PM-7235 - Add test suite for UserKeyInitService
* PM-7235 - Remove everBeenUnlocked as it is no longer needed
* PM-7235 - Fix tests
* PM-7235 - UserKeyInitSvc - per PR feedback, add error handling to protect observable stream from being cancelled in case of an error
* PM-7235 - Fix tests
* Update libs/common/src/platform/services/user-key-init.service.ts
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
* Update libs/common/src/platform/services/user-key-init.service.ts
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
* PM-7235 - AuthSvc - Per PR review, for getAuthStatus, only check user key existence in memory.
* PM-7235 - remove not useful test per PR feedback.
* PM-7235 - Per PR feedback, update cryptoService.hasUserKey to only check memory for the user key.
* PM-7235 - Per PR feedback, move user key init service listener to main.background instead of init service
* PM-7235 - UserKeyInitSvc tests - fix tests to plass
---------
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>