* PM-5501 - VaultTimeoutSettingsSvc - refactor var names in getVaultTimeoutAction
* PM-5501 - Add state definitions and key definitions + test deserialization of key defs.
* PM-5501 - Add state provider dep to VaultTimeoutSettingsSvc
* PM-5501 - Refactor getVaultTimeout
* PM-5501 - VaultTimeoutSettingsService - Build getMaxVaultTimeoutPolicyByUserId helper
* PM-5501 - (1) Update state definitions (2) convert KeyDefs to UserKeyDefs (2) Remove everBeenUnlocked as we won't need it
* PM-5501 - VaultTimeoutSettingsSvc - POC for getVaultTimeoutActionByUserId$ method + new private determineVaultTimeoutAction helper.
* PM-5501 - VaultTimeoutSettingsSvc - build set and observable get methods for vault timeout settings
* PM-5501 - Update web references to use new vault timeout setting service methods
* PM-5501 - VaultTimeoutSettingsSvc - write up abstraction js docs
* PM-5501 - VaultTimeoutSettingsSvc abstraction - finish tweaks
* PM-5501 - VaultTimeoutSettingsSvc - add catchError blocks to observables to protect outer observables and prevent cancellation in case of error.
* PM-5501 - Remove vault timeout settings from state service implementation.
* PM-5501 - VaultTimeoutSettingsServiceStateProviderMigrator first draft
* PM-5501 - WIP - replace some state service calls with calls to vault timeout settings svc.
* PM-5501 - Replace state service calls in login strategies to get vault timeout settings data with VaultTimeoutSettingsService calls.
* PM-5501 - Fix login strategy tests
* PM-5501 - Update login strategy tests to pass
* PM-5501 - CryptoSvc - share VaultTimeout user key def to allow crypto svc access to the vault timeout without creating a circular dep.
* PM-5501 - Fix dependency injections.
* PM-5501 - ApiSvc - replace state svc with vault timeout settings svc.
* PM-5501 - VaultTimeoutSettingsServiceStateProviderMigrator more cleanup
* PM-5501 - Test VaultTimeoutSettingsServiceStateProviderMigrator
* PM-5501 - VaultTimeoutSettingsSvc tests updated
* PM-5501 - Update all setVaultTimeoutOptions references
* PM-5501 - VaultTimeoutSettingsSvc - Update setVaultTimeoutOptions to remove unnecessary logic and clean up clearTokens condition.
* PM-5501 - Fix vault timeout service tests
* PM-5501 - Update VaultTimeoutSettings state tests to pass
* PM-5501 - Desktop - system svc - fix build by replacing use of removed method.
* PM-5501 - Fix CLI by properly configuring super class deps in NodeApiService
* PM-5501 - Actually finish getitng deps fixed to get CLI to build
* PM-5501 - VaultTimeoutSettingsSvc.determineVaultTimeoutAction - pass userId to getAvailableVaultTimeoutActions to prevent hang waiting for an active user.
* PM-5501 - VaultTimeoutSettingSvc test - enhance getVaultTimeoutActionByUserId$ to also test PIN scenarios as an unlock method
* PM-5501 - bump migration version
* PM-5501 - Refactor migration to ensure the migration persists null vault timeout values.
* PM-5501 - Bump migration version
* PM-5501 - Fix web build issues introduced by merging main.
* PM-5501 - Bump migration version
* PM-5501 - PreferencesComponent - revert dep change from InternalPolicyService to standard PolicyService abstraction
* PM-5501 - Address all PR feedback from Jake
Co-authored-by: Jake Fink <jfink@bitwarden.com>
* PM-5501 - VaultTimeoutSettingsSvc tests - add tests for setVaultTimeoutOptions
* PM-5501 - VaultTimeoutSettingsSvc - setVaultTimeoutOptions - Update tests to use platform's desired syntax.
* PM-5501 - Fix tests
* PM-5501 - Create new VaultTimeout type
* PM-5501 - Create new DEFAULT_VAULT_TIMEOUT to allow each client to inject their default timeout into the VaultTimeoutSettingService
* PM-5501 - Migrate client default vault timeout to new injection token
* PM-5501 - Update VaultTimeoutSettingsSvc to use VaultTimeout type and apply default vault timeout if it is null.
* PM-5501 - Update vaultTimeout: number to be vaultTimeout: VaultTimeout everywhere I could find it.
* PM-5501 - More changes based on changing vaultTimeout from number to VaultTimeout type.
* PM-5501 - VaultTimeoutSvc - Update shouldLock logic which previously checked for null (never) or any negative values (any strings except never) with a simple string type check.
* PM-5501 - More cleanup of vaultTimeout type change - replacing null checks with "never" checks
* PM-5501 - VaultTimeoutSettingsSvc - refactor determineVaultTimeout to properly treat string and numeric vault timeouts.
* PM-5501 - Update vault timeout settings service tests to reflect new VaultTimeout type.
* PM-5501 - VaultTimeoutSettingsService - add more test cases for getVaultTimeoutByUserId
* PM-5501 - (1) Remove "immediately" as 0 is numerically meaningful and can be used with Math.min (2) Add VaultTimeoutOption interface for use in all places we show the user a list of vault timeout options.
* PM-5501 - VaultTimeoutSettingSvc - update tests to use 0 as immediately.
* PM-5501 - VaultTimeoutInputComp - Add new types and update applyVaultTimeoutPolicy logic appropriately.
* PM-5501 - Add new types to all preferences and setting components across clients.
* PM-5501 - Fix bug on web where navigating to the preferences page throws an error b/c the validatorChange function isn't defined.
* PM-5501 - WIP on updating vault timeout setting migration and rollback + testing it.
* PM-5501 - Update VaultTimeoutSettingsSvc state provider migration and tests to map existing possible values into new VaultTImeout type.
* PM-5501 - Fix vault timeout settings state tests by changing number to new VaultTimeout type.
* PM-5501 - Fix crypto svc auto key refresh test to use "never" instead of null.
* PM-5501 - Add clarifying comment to vaulttimeout type
* PM-5501 - Desktop app comp - replace systemTimeoutOptions with vault timeout type.
* PM-5501 - Update vault timeout service tests to use VaultTimeout type.
* PM-5501 - VaultTimeoutSettingsSvc - (1) Fix bug where vault timeout action didn't have a default like it did before (2) Fix bug in userHasMasterPassword where it would incorrectly return the active user stream for a given user id as a fallback. There is no guarantee the given user would match the active user so the paths are mutually exclusive.
* PM-5501 - Login Strategy fix - Move retrieval of vault timeout settings and setting of the tokens until after account init and user decryption options set as those opts are needed to properly determine the user's available vault timeout actions.
* PM-5501 - Fix vault timeout settings svc tests
* PM-5501 - VaultTimeoutSettingSvc - move default logic to determine methods + refactor default vault timeout action to properly default to lock in scenarios the user has lock available.
* Update libs/angular/src/components/settings/vault-timeout-input.component.ts
Co-authored-by: Cesar Gonzalez <cesar.a.gonzalezcs@gmail.com>
* PM-5501 - Per PR feedback, cleanup commented out vault timeout options
* PM-5501 - Fix vault timeout input comp lint issues
* PM-5501 - Per PR feedback from Cesar, update VaultTimeout type to use const so we can avoid any magic string usage. Awesome.
Co-authored-by: Cesar Gonzalez <cesar.a.gonzalezcs@gmail.com>
* PM-5501 - CLI - use "never" as default vault timeout instead of null.
* PM-5501 - Fix broken tests
* PM-5501 - Bump migration version
* PM-5501 - Fix build errors after merging main.
* PM-5501 - Update mockMigrationHelper to pass along client type so tests will respect it.
* PM-5501 - Update VaultTimeoutSettingsServiceStateProviderMigrator and tests to use new CLI client type to convert undefined values to never so that CLI users don't lose their session upon running this migration.
* PM-5501 - Bump migration version
* PM-5501 - Fix migration tests to use new authenticated user format
* PM-5501 Update rollback tests
* PM-5501 - Adjust migration based on feedback.
* PM-5501 - Per Jake's find, fix missed -2
Co-authored-by: Jake Fink <jfink@bitwarden.com>
* PM-5501 - Add user id to needsStorageReseed.
Co-authored-by: Jake Fink <jfink@bitwarden.com>
* PM-5501 - Per PR feedback, setVaultTimeoutOptions shouldn't accept null for vault timeout anymore.
* PM-5501 - Per PR feedback, add null checks for set methods for setting vault timeout or vault timeout action.
* PM-5501 - Per PR feedback, add more context as to why we need vault timeout settings to persist after logout.
* PM-5501 - Per PR feedback, fix userHasMasterPassword
* PM-5501 - VaultTimeoutSettingsService - fix userHasMasterPassword check by checking for null decryption options.
* PM-5501 - Remove state service from vault timeout settings service (WOOO)
* PM-5501 - Bump migration version
* PM-5501 - Account Security comp - refactor to consider ease of debugging.
* PM-5501 - (1) Add checks for null vault timeout and vault timeout actions (2) Add tests for new scenarios.
* PM-5501 - VaultTimeoutSettingsSvc - setVaultTimeoutOptions - fix bug where nullish check would throw incorrectly if immediately (0) was picked as the timeout.
* PM-5501 - Per PR feedback, clean up remaining token service methods which accept null for timeout and add tests. .
* PM-5501 - Fix nit
---------
Co-authored-by: Jake Fink <jfink@bitwarden.com>
Co-authored-by: Cesar Gonzalez <cesar.a.gonzalezcs@gmail.com>
* 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
* [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
* Match console method signatures in logService abstraction
* Add a few usages of improved signature
* Remove reality check test
* Improve electron logging
* 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.
* fixed issue with clearing search index state
* clear user index before account is totally cleaned up
* added logout clear on option
* removed redundant clear index from logout
* fixed ownsership dropdown issu where async operations does bot complete early enough before the view is shown
* remove 2fa from main.background
* remove login strategy service from main.background
* move 2fa and login strategy service to popup, init in browser
* add state providers to 2fa service
- add deserializer helpers
* use key definitions for global state
* fix calls to 2fa service
* remove extra await
* add delay to wait for active account emission in popup
* add and fix tests
* fix cli
* really fix cli
* remove timeout and wait for active account
* verify expected user is active account
* fix tests
* address feedback
* Introduce browser large object storage location.
This location is encrypted and serialized to disk in order to allow for storage of uncountable things like vault items that take a significant amount of time to prepare, but are not guaranteed to fit within session storage.
however, limit the need to write to disk is a big benefit, so _most_ things are written to storage.session instead, where things specifically flagged as large will be moved to disk-backed memory
* Store derived values in large object store for browser
* Fix AbstractMemoryStorageService implementation
* PM-6689 - Add security stamp to Token state
* PM-6689 - Remove Security Stamp from account and state service
* PM-6689 - Add security stamp get and set to token service + abstraction + tests
* PM-6689 - Add migration for security stamp, test it, and register it with migrator
* PM-6689 - Update sync service + deps to use token service.
* PM-6689 - Cleanup missed usages of account tokens which has been removed.
* PM-6689 - Per PR feedback, remove unnecessary data migration as the security stamp is only in memory and doesn't need to be migrated.
* 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>
* Refactoring
* Hide SM toggle on member invite and default to true for SM standalone org
* changed from hide sm checkbox to default and disable
* Removed errant addition from conflict resolution
* initial commit
* add changes from running prettier
* resolve the linx issue
* resolve the lint issue
* resolving lint error
* correct the redirect issue
* resolve pr commit
* Add a feature flag
* move the new component to adminconsole
* resolve some pr comments
* move the endpoint from ApiService to providerApiService
* move provider endpoints to the provider-api class
* change the header
* resolve some pr comments
* remove active account unlocked from state service
* Remove status from account service `AccountInfo`
* Fixup lingering usages of status
Fixup missed factories
* Fixup account info usage
* fixup CLI build
* Fixup current account type
* Add helper for all auth statuses to auth service
* Fix tests
* Uncomment mistakenly commented code
* Rework logged out account exclusion tests
* Correct test description
* Avoid getters returning observables
* fixup type
* Boostrap basic banner, show for all admins
* Remove UI banner, fix method calls
* Invert showBanner -> hideBanner
* Add api call
* Minor tweaks and wording
* Change to active user state
* Add tests
* Fix mixed up names
* Simplify logic
* Add feature flag
* Do not clear on logout
* Show banner in browser as well
* Update apps/browser/src/_locales/en/messages.json
* Update copy
---------
Co-authored-by: Addison Beck <github@addisonbeck.com>
Co-authored-by: Addison Beck <hello@addisonbeck.com>
* refactored injector of services on the browser service module
* refactored the search and popup serach service to use state provider
* renamed back to default
* removed token service that was readded during merge conflict
* Updated search service construction on the cli
* updated to use user key definition
* Reafctored all components that refernce issearchable
* removed commented variable
* added uncommited code to remove dependencies not needed anymore
* added uncommited code to remove dependencies not needed anymore
* create mp and kdf service
* update mp service interface to not rely on active user
* rename observable methods
* update crypto service with new MP service
* add master password service to login strategies
- make fake service for easier testing
- fix crypto service tests
* update auth service and finish strategies
* auth request refactors
* more service refactors and constructor updates
* setMasterKey refactors
* remove master key methods from crypto service
* remove master key and hash from state service
* missed fixes
* create migrations and fix references
* fix master key imports
* default force set password reason to none
* add password reset reason observable factory to service
* remove kdf changes and migrate only disk data
* update migration number
* fix sync service deps
* use disk for force set password state
* fix desktop migration
* fix sso test
* fix tests
* fix more tests
* fix even more tests
* fix even more tests
* fix cli
* remove kdf service abstraction
* add missing deps for browser
* fix merge conflicts
* clear reset password reason on lock or logout
* fix tests
* fix other tests
* add jsdocs to abstraction
* use state provider in crypto service
* inverse master password service factory
* add clearOn to master password service
* add parameter validation to master password service
* add component level userId
* add missed userId
* migrate key hash
* fix login strategy service
* delete crypto master key from account
* migrate master key encrypted user key
* rename key hash to master key hash
* use mp service for getMasterKeyEncryptedUserKey
* fix tests
* fix user key decryption logic
* add clear methods to mp service
* fix circular dep and encryption issue
* fix test
* remove extra account service call
* use EncString in state provider
* fix tests
* return to using encrypted string for serialization
* create mp and kdf service
* update mp service interface to not rely on active user
* rename observable methods
* update crypto service with new MP service
* add master password service to login strategies
- make fake service for easier testing
- fix crypto service tests
* update auth service and finish strategies
* auth request refactors
* more service refactors and constructor updates
* setMasterKey refactors
* remove master key methods from crypto service
* remove master key and hash from state service
* missed fixes
* create migrations and fix references
* fix master key imports
* default force set password reason to none
* add password reset reason observable factory to service
* remove kdf changes and migrate only disk data
* update migration number
* fix sync service deps
* use disk for force set password state
* fix desktop migration
* fix sso test
* fix tests
* fix more tests
* fix even more tests
* fix even more tests
* fix cli
* remove kdf service abstraction
* add missing deps for browser
* fix merge conflicts
* clear reset password reason on lock or logout
* fix tests
* fix other tests
* add jsdocs to abstraction
* use state provider in crypto service
* inverse master password service factory
* add clearOn to master password service
* add parameter validation to master password service
* add component level userId
* add missed userId
* migrate key hash
* fix login strategy service
* delete crypto master key from account
* migrate master key encrypted user key
* rename key hash to master key hash
* use mp service for getMasterKeyEncryptedUserKey
* fix tests
* introduce legacy generators
* introduce generator navigation service
* Introduce default options. These accept a userId so that they can be policy-defined
* replace `GeneratorOptions` with backwards compatible `GeneratorNavigation`
Fix environment selector being broken on desktop. When selecting self-hosted and filling in a url, the selector fails to update when returning and instead produces the following console error.
* Adding the key definitions and tests and initial send state service
* Adding the abstraction and implementing
* Planning comments
* Everything but fixing the send tests
* Moving send tests over to the state provider
* jslib needed name refactor
* removing get/set encrypted sends from web vault state service
* browser send state service factory
* Fixing conflicts
* Removing send service from services module and fixing send service observable
* Commenting the migrator to be clear on why only encrypted
* No need for service factories in browser
* browser send service is no longer needed
* Key def test cases to use toStrictEqual
* Running prettier
* Creating send test data to avoid code duplication
* Adding state provider and account service to send in cli
* Fixing the send service test cases
* Fixing state definition keys
* Moving to observables and implementing encryption service
* Fixing key def tests
* The cli was using the deprecated get method
* The observables init doesn't need to happen in constructor
* Missed commented out code
* If enc key is null get user key
* Service factory fix
* call injector explicitly in ErrorHandler
* Fallback to `super` on early error
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
---------
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>,
* PM-5268 - Add DEVICE_TRUST_DISK to state definitions
* PM-5268 - DeviceTrustCryptoService - Get most of state provider refactor done - WIP - commented out stuff for now.
* PM-5268 - DeviceTrustCryptoServiceStateProviderMigrator - WIP - got first draft of migrator in place and working on tests. Rollback tests are failing for some reason TBD.
* PM-5268 - more WIP on device trust crypto service migrator tests
* PM-5268 - DeviceTrustCryptoServiceStateProviderMigrator - Refactor based on call with platform
* PM-5268 - DeviceTrustCryptoServiceStateProviderMigrator - tests passing
* PM-5268 - Update DeviceTrustCryptoService to convert over to state providers + update all service instantiations / dependencies to ensure state provider is passed in or injected.
* PM-5268 - Register new migration
* PM-5268 - Temporarily remove device trust crypto service from migrator to ease merge conflicts as there are 6 more migrators before I can apply mine in main.
* PM-5268 - Update migration numbers of DeviceTrustCryptoServiceStateProviderMigrator based on latest migrations from main.
* PM-5268 - (1) Export new KeyDefinitions from DeviceTrustCryptoService for use in test suite (2) Update DeviceTrustCryptoService test file to use state provider.
* PM-5268 - Fix DeviceTrustCryptoServiceStateProviderMigrator tests to use proper versions
* PM-5268 - Actually fix all instances of DeviceTrustCryptoServiceStateProviderMigrator test failures
* PM-5268 - Clean up state service, account, and login strategy of all migrated references
* PM-5268 - Account - finish cleaning up device key
* PM-5268 - StateService - clean up last reference to device key
* PM-5268 - Remove even more device key refs. *facepalm*
* PM-5268 - Finish resolving merge conflicts by incrementing migration version from 22 to 23
* PM-5268 - bump migration versions
* PM-5268 - DeviceTrustCryptoService - Implement secure storage functionality for getDeviceKey and setDeviceKey (to achieve feature parity with the ElectronStateService implementation prior to the state provider migration). Tests to follow shortly.
* PM-5268 - DeviceTrustCryptoService tests - getDeviceKey now tested with all new secure storage scenarios. SetDeviceKey tests to follow.
* PM-5268 - DeviceTrustCryptoService tests - test all setDeviceKey scenarios with state provider & secure storage
* PM-5268 - Update DeviceTrustCryptoService deps to actually use secure storage svc on platforms that support it.
* PM-5268 - Bump migration version due to merge conflicts.
* PM-5268 - Bump migration version
* PM-5268 - tweak jsdocs to be single line per PR feedback
* PM-5268 - DeviceTrustCryptoSvc - improve debuggability.
* PM-5268 - Remove state service as a dependency on the device trust crypto service (woo!)
* PM-5268 - Update migration test json to correctly reflect reality.
* PM-5268 - DeviceTrustCryptoSvc - getDeviceKey - add throw error for active user id missing.
* PM-5268 - Fix tests
* PM-5268 - WIP start on adding user id to every method on device trust crypto service.
* PM-5268 - Update lock comp dependencies across clients
* PM-5268 - Update login via auth request deps across clients to add acct service.
* PM-5268 - UserKeyRotationSvc - add acct service to get active acct id for call to rotateDevicesTrust and then update tests.
* PM-5268 - WIP on trying to fix device trust crypto svc tests.
* PM-5268 - More WIP device trust crypto svc tests passing
* PM-5268 - Device Trust crypto service - get all tests passing
* PM-5268 - DeviceTrustCryptoService.getDeviceKey - fix secure storage b64 to symmetric crypto key conversion
* PM-5268 - Add more tests and update test names
* PM-5268 - rename state to indicate it was disk local
* PM-5268 - DeviceTrustCryptoService - save symmetric key in JSON format
* PM-5268 - Fix lock comp tests by adding acct service dep
* PM-5268 - Update set device key tests to pass
* PM-5268 - Bump migration versions again
* PM-5268 - Fix user key rotation svc tests
* PM-5268 - Update web jest config to allow use of common spec in user-key-rotation-svc tests
* PM-5268 - Bump migration version
* PM-5268 - Per PR feedback, save off user id
* PM-5268 - bump migration version
* PM-5268 - Per PR feedback, remove unnecessary await.
* PM-5268 - Bump migration verson
* add remove button for passkeys during edit
* added live region to announce when a passkey is removed
* removed announce passkey removed by SR
* removed unused variable
We currently use a callback syntax for abstract services. This syntax isn't completely strict compliant and will fail the strictPropertyInitialization check. We also currently don't get any compile time errors if we forget to implement a function.
To that end this PR updates all platform owned services to use the appropriate abstract keyword for non implemented functions. I also updated the fields to be actual functions and not properties.
* Create tracker that can await until expected observables are received.
* Test dates are almost equal
* Remove unused class method
* Allow for updating active account in accout service fake
* Correct observable tracker behavior
Clarify documentation
* Transition config service to state provider
Updates the config fetching behavior to be lazy and ensure that any emitted value has been updated if older than a configurable value (statically compiled).
If desired, config fetching can be ensured fresh through an async.
* Update calls to config service in DI and bootstrapping
* Migrate account server configs
* Fix global config fetching
* Test migration rollback
* Adhere to implementation naming convention
* Adhere to abstract class naming convention
* Complete config abstraction rename
* Remove unnecessary cli config service
* Fix builds
* Validate observable does not complete
* Use token service to determine authed or unauthed config pull
* Remove superfluous factory config
* Name describe blocks after the thing they test
* Remove implementation documentation
Unfortunately the experience when linking to external documentation is quite poor. Instead of following the link and retrieving docs, you get a link that can be clicked to take you out of context to the docs. No link _does_ retrieve docs, but lacks indication in the implementation that documentation exists at all.
On the balance, removing the link is the better experience.
* Fix storybook
Move export.component
Export from @bitwarden/vault-export-ui
Fix imports on browser, desktop and web
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* PM-5263 - TokenSvc - WIP on access token secure storage refactor
* PM-5263 - Add key generation svc to token svc.
* PM-5263 - TokenSvc - more progress on encrypt access token work.
* PM-5263 - TokenSvc TODO cleanup
* PM-5263 - TokenSvc - rename
* PM-5263 - TokenSvc - decryptAccess token must return null as that is a valid case.
* PM-5263 - Add EncryptSvc dep to TokenSvc
* PM-5263 - Add secure storage to token service
* PM-5263 - TokenSvc - (1) Finish implementing accessTokenKey stored in secure storage + encrypted access token stored on disk (2) Remove no longer necessary migration flag as the presence of the accessTokenKey now serves the same purpose.
Co-authored-by: Jake Fink <jfink@bitwarden.com>
* PM-5263 - TokenSvc - (1) Tweak return structure of decryptAccessToken to be more debuggable (2) Add TODO to add more error handling.
* PM-5263 - TODO: update tests
* PM-5263 - add temp logs
* PM-5263 - TokenSvc - remove logs now that I don't need them.
* fix tests for access token
* PM-5263 - TokenSvc test cleanup - small tweaks / cleanup
* PM-5263 - TokenService - per PR feedback from Justin - add error message to error message if possible.
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
---------
Co-authored-by: Jake Fink <jfink@bitwarden.com>
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* Fallback to Emitting `null` When No Active User
* Fix Tests
* Update Test Names to Follow Convention
Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
* Fix CLI Build
---------
Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
* Fix error on close due to context differences in background
Desktop background does not have active user information. Also, we want to delete _all_ prompt cancelled data, not just that for the active user. Storing this on global and manipulating observables to active achieves this without needing any user information in the background.
* Remove potentially orphaned data
* Throw nice error if prompt cancelled used without active user
* Register migration
* split prompt cancelled reset to user-specific and global
Refactor environment service to emit a single observable. This required significant changes to how the environment service behaves and tackles much of the tech debt planned for it.
* collections component shows disable readOnly collections in the org vault edit collections modal, and will check if org allows Owners up manage all collections in ciphers
* create new user decryption options service
* rename new service to user decryption options
* add hasMasterPassword to user decryption options service
* migrate device trust service to new user decryption options service
* add migration for user-decryption-options
* migrate sync service and calls to trust-device-service
* rename abstraction file
* migrate two factor component
* migrate two factor spec
* migrate sso component
* migrate set-password component
* migrate base login decryption component
* migrate organization options component
* fix component imports
* add missing imports
- remove state service calls
- add update user decryption options method
* remove acct decryption options from account
* lint
* fix tests and linting
* fix browser
* fix desktop
* add user decryption options service to cli
* remove default value from migration
* bump migration number
* fix merge conflict
* fix vault timeout settings
* fix cli
* more fixes
* add user decryption options service to deps of vault timeout settings service
* update login strategy service with user decryption options
* remove early return from sync bandaid for user decryption options
* move user decryption options service to lib/auth
* move user decryption options to libs/auth
* fix reference
* fix browser
* check user decryption options after 2fa check
* update migration and revert tsconfig changes
* add more documentation
* clear user decryption options on logout
* fix tests by creating helper for user decryption options
* fix tests
* pr feedback
* fix factory
* update migration
* add tests
* update missed migration num in test
* PM-6780 - Create vault-export-ui package
* Migrate export-scope-callout to CL
- Move export-scope-callout.component to vault-export-UI
- Use bit-callout instead of app-callout
- Make component standalone
- Remove from jslib.module
- Prefix selector with team-name
- Export it from vault-export-ui
* Update usage of tools-export-scope-callout for desktop
* Update usage of tools-export-scope-callout for web
* Update usage of tools-export-scope-callout for browser
* Change package description
---------
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* Fix a typo in the `StateDefinition` description
* Introduce `OrganizationManagementPreferencesService`
* Declare `OrganizationManagementPreferencesService` in DI
* Update `autoConfirmFingerPrints` logic in emergency access files
* Update `autoConfirmFingerPrints` logic in `people` files
* Remove `autoConfirmFingerPrints` from `StateService` and `Account`
* Migrate existing client data for `autoConfirmFingerPrints`
* Update apps/web/src/app/admin-console/organizations/manage/user-confirm.component.ts
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
* Update apps/web/src/app/admin-console/organizations/manage/user-confirm.component.ts
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
* Use `set` instead of `update` for function names
---------
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
* Remove formPromise and use bitSubmit
* Use formGroup.invalid instead of !valid
* Move variables related to encrypted exports into base component.
* Migrate to use new userVerificationDialogComponent
---------
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* add showFavicons to domain settings
* replace usages of disableFavicon with showFavicons via the domain settings service and remove/replace settings service
* create migration for disableFavicon
* cleanup
* event upload and collection state provider migration
* cipher can be null when exporting org
* Addressing pr comments. Casting UserId from calling methods
* fixing userAuth observable in event collection service
* Adding more documentation for the changes.
* cli needed state provider and account services added
* Addressing pr comments on modifying should update
* No need to auth on event upload
* Simplifying the takeEvents for pulling user events
* Reverting shouldUpdate to previous state
* Removing redundant comment
* Removing account service for event upload
* Modifying the shouldUpdate to evaluate the logic outside of the observable
* Adding back in the auth for event upload service and adding event upload to the cli logout method
* Adding the browser service factories
* Updating the browser services away from get background
* Removing event collect and upload services from browser services
* Removing the audit service import
* Adding the event collection migration and migration test
* Event collection state needs to be stored on disk
* removing event collection from state service and abstraction
* removing event collection from the account data
* Saving the migrations themselves
* Added billing account profile state service
* Update usages after removing state service functions
* Added migrator
* Updated bw.ts and main.background.ts
* Removed comment
* Updated state service dependencies to include billing service
* Added missing mv3 factory and updated MainContextMenuHandler
* updated autofill service and tests
* Updated the remaining extensions usages
* Updated desktop
* Removed subjects where they weren't needed
* Refactored billing service to have a single setter to avoid unecessary emissions
* Refactored has premium guard to return an observable
* Renamed services to match ADR
f633f2cdd8/docs/architecture/clients/presentation/angular.md (abstract--default-implementations)
* Updated property names to be a smidgen more descriptive and added jsdocs
* Updated setting of canAccessPremium to automatically update when the underlying observable emits
* Fixed build error after merge conflicts
* Another build error from conflict
* Removed autofill unit test changes from conflict
* Updated login strategy to not set premium field using state service
* Updated CLI to use billing state provider
* Shortened names a bit
* Fixed build
* PM-5263 - Token Service state migration - (1) Got key and state definitions setup (2) Ported over core state service getTimeoutBasedStorageOptions method logic into local determineStorageLocation method (3) Updated majority of methods to use state provider state
* PM-5263 - StateSvc - add TODO to remove timeoutBasedStorageOptions + other state methods after migration code complete.
* PM-5263 - TokenSvc - ClearToken method - (1) Update signature to remove user id as it wasn't used and it simplifies the new state provider implementation (2) Convert away from state svc to state provider state.
* PM-5263 - TokenService - update deps - WIP on circular dep issues.
* PM-5263 - To resolve circular dep issues between VaultTimeoutSettingsSvc and TokenService: (1) For writes, require callers to pass in vault timeout data (2) For reads, we can just check both locations. This approach has 1 less state call than the previous implementation and is safe as long as the clear logic properly works and is executed anytime a user changes their vault timeout action (lock or log out) & vault timeout (numeric value)
* PM-5263 - VaultTimeoutSettingsSvc - Set token calls now updated to include vault timeout info.
* PM-5263 - Update API Service - add state service and look up vault timeout details and pass to token service when setting token info.
* PM-5263 - TokenService - update service dependencies.
* PM-5263 - TokenService - Add new getAccessTokenByUserId method for state service use case.
* PM-5263 - StateSvc - remove migrated methods and try to replace all usages of getAccessToken. WIP
* PM-5263 - TokenSvc Migration - start on migrator
* PM-5263 - (1) TokenSvc - Build new clearAccessTokenByUserId which is required by state service (2) TokenSvc - Update getToken to take an optional userId to handle another state service case (3) Add some documentation to TokenSvc abstraction.
* PM-5263 - StateService - finish updating all calls within the state service which accessed token service state directly with calls to the new token service methods instead.
* PM-5263 - TokenSvc Abstraction - Add more docs
* PM-5263 - TokenSvc abstraction - more doc tweaks
* PM-5263 - Web state service - add new token service dependency.
* PM-5263 - User API Key Login Strategy - Update to pull vault timeout action and vault timeout from state service in order to pass to new token service endpoints for setting API key client id and secret.
* PM-5263 - (1) Remove TokenSvc owned state from account (2) StateSvc - remove account scaffold logic for clearing removed account data. The same functionality will exist in the state provider framework via lifecycle hooks cleaning up this data and users getting initialized with null data by default.
* PM-5263 - Add token service dependency to state service (WIP - desktop deps not working)
* PM-5263 - Update services module on desktop and browser to add token svc dependency
* PM-5263 - API service factory - add state service factory dependency that I missed initially to get browser building.
* PM-5263 - TokenSvc - getToken/setToken/decodeToken --> getAccessToken/setAccessToken/decodeAccessToken
* PM-5263 - TokenSvc State Provider Migrator - WIP - update expected acct type to match actual account
* PM-5263 - TokenService - clearToken renamed to clearTokens
* PM-5263 - CLI - NodeApiService - add state service dep to get CLI building.
* PM-5263 - StateDefinitions - use unique state definition names
* PM-5263 - StateSvc - remove getTimeoutBasedStorageOptions as no longer used.
* PM-5263 - TokenSvc - Add TODO for figuring out how to store tokens in secure storage.
* PM-5263 - StateSvc - remove get/set 2FA token - references migrated later.
* PM-5263 - TODO: figure out if using same key definition names is an issue
* PM-5263 - TokenServiceStateProviderMigrator written
* PM-5263 - TokenServiceStateProviderMigrator - (1) Don't update legacy account if we only added a new state in state provider for 2FA token (2) Use for loop for easier debugging
* PM-5263 - TokenServiceStateProviderMigrator test - WIP - migration testing mostly complete and passing. Rollback logic TODO.
* PM-5263 - TokenServiceStateProviderMigrator - Add rollback logic to restore 2FA token from users to global.
* PM-5263 - TokenServiceStateProviderMigrator - Refactor rollback to only set account once as not necessary to set it every time.
* PM-5263 - TokenServiceStateProviderMigrator tests - test all rollback scenarios
* PM-5263 - Remove TODO as don't need unique key def names as long as state def keys are unique.
* PM-5263 - TokenSvc - update clearAccessTokenByUserId to use proper state provider helper method to set state.
* PM-5263 - Revert accidentally committing settings.json changes.
* PM-5263 - TokenSvc - update all 2FA token methods to require email so we can user specifically scope 2FA tokens while still storing them in global storage.
* PM-5263 - Update all token service 2FA set / get / clear methods to pass in email.
* PM-5263 - JslibServices module - add missed login service to login strategy svc deps.
* PM-5263 - VaultTimeoutSettingsService - setVaultTimeoutOptions - rename token to accesToken for clarity.
* PM-5263 - (1) TokenSvc - remove getAccessTokenByUserId and force consumers to use getAccessToken w/ optional user id to keep interface small (2) TokenSvc - attempt to implement secure storage on platforms that support it for access & refresh token storage (3) StateSvc - replace usage of getAccessTokenByUserId with getAccessToken
* PM-5263 - TokenSvc - add platform utils and secure storage svc deps
* PM-5263 - TODO: figure out what to do with broken migration
* PM-5263 - TODO: update tests in light of latest 2FA token changes.
* PM-5263 - TokenSvc - clean up TODO
* PM-5263 - We should have tests for the token service.
* PM-5263 - TokenSvc - setAccessToken - If platform supports secure storage and we are saving an access token, remove the access token from memory and disk to fully migrate to secure storage.
* PM-5263 - TokenSvc - getAccessToken - Update logic to look at memory and disk first always and secure storage last to support the secure storage migration
* PM-5263 - TokenSvc - setAccesToken - if user id null on a secure storage supporting platform, throw error.
* PM-5263 - TokenService - (1) Refresh token now stored in secure storage (2) Refresh token set now private as we require a user id to store it in secure storage and we can use the setTokens method to enforce always setting the access token and refresh token together in order to extract a user id from the refresh token. (3) setTokens clientIdClientSecret param now optional
* PM-5263 - TokenServiceStateProviderMigrator - update migration to take global but user scoped 2FA token storage changes into account.
* PM-5263 - Remove old migration as it references state we are removing. Bump min version.
Co-authored-by: Matt Gibson <git@mgibson.dev>
* PM-5263 - TokenService - 2FA token methods now backed by global state record which maps email to individual tokens.
* PM-5263 - WIP on Token Svc migrator and test updates based on new 2FA token storage changes.
* PM-5263 - TokenSvc - (1) Add jira tickets to clean up state migration (2) Add state to track secure storage migration to improve # of reads to get data
* PM-5263 - StateDef - consolidate name of token domain state defs per feedback from Justin + update migration tests
* PM-5263 - TokenSvc - fix error message and add TODO
* PM-5263 - Update token service migration + tests to pass after all 2FA token changes.
* PM-5263 - Fix all login strategy tests which were failing due to token state provider changes + the addition of the loginService as a dependency in the base login strategy.
* PM-5263 - Register TokenService state provider migration with migrator
* PM-5263 - TokenSvc state migration - set tokens after initializing account
* PM-5263 - TokenService changes - WIP - convert from ActiveUserStateProvider to just SingleUserStateProvider to avoid future circ dependency issues.
Co-authored-by: Jake Fink <jlf0dev@users.noreply.github.com>
* PM-5263 - TokenSvc - create getSecureStorageOptions for centralizing all logic for getting data out of SecureStorage.
* PM-5263 - TokenSvc - (1) Refactor determineStorageLocation to also determine secure storage - created a TokenStorageLocation string enum to remove magic strings (2) Refactor setAccessToken to use switch (3) Refactor clearAccessTokenByUserId to clear all locations and not early return on secure storage b/c we only use secure storage if disk is the location but I don't want to require vault timeout data for this method.
* PM-5263 - TokenSvc - getDataFromSecureStorage - Refactor to be more generic for easier re-use
* PM-5263 - TokenSvc - Convert refresh token methods to use single user state and require user ids
* PM-5263 - VaultTimeoutSettingsSvc - get user id and pass to access and refresh token methods.
* PM-5263 - TokenSvc - refactor save secure storage logic into private helper.
* PM-5263 - Base Login Strategy - per discussion with Justin, move save of tokens to before account initialization as we can always derive the user id from the access token. This will ensure that the account is initialized with the proper authN status.
* PM-5263 - TokenSvc - latest refactor - update all methods to accept optional userId now as we can read active user id from global state provider without using activeUserStateProvider (thus, avoiding a circular dep and having to have every method accept in a mandatory user id).
* PM-5263 - VaultTimeoutSettingsService - remove user id from token calls
* PM-5263 - TokenSvc - update all places we instantiate token service to properly pass in new deps.
* PM-5263 - TokenSvc migration is now 27th instead of 23rd.
* PM-5263 - Browser - MainContextMenuHandler - Update service options to include PlatformUtilsServiceInitOptions as the TokenService requires that and the TokenService is now injected on the StateService
* PM-5263 - TokenSvc migration test - update rollback tests to start with correct current version
* PM-5263 - Create token service test file - WIP
* PM-5263 - TokenSvc - tests WIP - instantiates working.
* PM-5263 - TokenSvc - set2FAToken - use null coalesce to ensure record is instantiated for new users before setting data on it.
* PM-5263 - TokenService tests - WIP - 2FA token tests.
* PM-5263 - Worked with Justin to resolve desktop circular dependency issue by adding SUPPORTS_SECURE_STORAGE injection token instead of injecting PlatformUtilsService directly into TokenService.
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* PM-5263 - TokenSvc tests - WIP - (1) Update TokenSvc instantiation to use new supportsSecureStorage (2) Test TwoFactorToken methods
* PM-5263 - Fix SUPPORTS_SECURE_STORAGE injection token to properly call supportsSecureStorage message
* PM-5263 - Token state testing
* PM-5263 - TokenState fix name of describe
* PM-5263 - TokenService - export TokenStorageLocation for use in tests.
* PM-5263 - TokenSvc Tests WIP
* PM-5263 - TokenSvc tests - access token logic mostly completed.
* PM-5263 - TokenSvc Tests - more WIP - finish testing access token methods.
* PM-5263 - TokenSvc WIP - another clear access token test.
* PM-5263 - TokenSvc tests - WIP - SetTokens tested.
* PM-5263 - Tweak test name
* PM-5263 - TokenSvc tests - remove unnecessary describe around 2FA token methods.
* PM-5263 - TokenSvc.clearAccessTokenByUserId renamed to just clearAccessToken
* PM-5263 - TokenSvc - refactor clearTokens logic and implement individual clear logic which doesn't require vault timeout setting information.
* PM-5263 - TokenSvc - Replace all places we have vaultTimeout: number with vaultTimeout: number | null to be accurate.
* PM-5263 - TokenSvc.clearTokens - add check for user id; throw if not found
* PM-5263 - TokenService - test clearTokens
* PM-5263 - TokenSvc Tests - setRefreshToken tested
* PM-5263 - TokenSvc tests - getRefreshToken tested + added a new getAccessToken test
* PM-5263 - TokenSvc - ClearRefreshToken scenarios tested.
* PM-5263 - TokenSvc.clearRefreshToken tests - fix copy pasta
* PM-5263 - TokenSvc tests - (1) Fix mistakes in refresh token testing (2) Test setClientId for all scenarios
* PM-5263 - TokenSvc tests - (1) Add some getClientId tests (2) clarify lack of awaits
* PM-5263 - TokenSvc Tests - WIP - getClientId && clearClientId
* PM-5263 - TokenService - getClientSecret - fix error message
* PM-5263 - TokenService tests - test all client secret methods
* PM-5263 - Update TokenSvc migration to 30th migration
* PM-5263 - TokenService - update all tests to initialize data to undefined now that fake state provider supports faking data based on specific key definitions.
* PM-5263 - (1) TokenSvc.decodeAccessToken - update static method's error handling (2) TokenSvc tests - test all decodeAccessToken scenarios
* PM-5263 - TokenSvc - (1) Add DecodedAccessToken type (2) Refactor getTokenExpirationDate logic to use new type and make proper type checks for numbers for exp claim values.
* PM-5263 - TokenSvc tests - test getTokenExpirationDate method.
* PM-5263 - TokenSvc - (1) Update DecodedAccessToken docs (2) Tweak naming in tokenSecondsRemaining
* PM-5263 - TokenSvc abstraction - add jsdoc for tokenSecondsRemaining
* PM-5263 - TokenSvc tests - test tokenSecondsRemaining
* PM-5263 - TokenSvc - DecodedAccessToken type - update sstamp info
* PM-5263 - TokenService - fix flaky tokenSecondsRemaining tests by locking time
* PM-5263 - TokenSvc Tests - Test tokenNeedsRefresh
* PM-5263 - (1) TokenSvc - Refactor getUserId to add extra safety (2) TokenSvc tests - test getUserId
* PM-5263 - (1) TokenSvc - refactor getUserIdFromAccessToken to handle decoding errors (2) TokenSvc tests - test getUserIdFromAccessToken
* PM-5263 - (1) TokenSvc - Refactor getEmail to handle decoding errors + check for specific, expected type (2) TokenSvc tests - test getEmail
* PM-5263 - TokenSvc tests - clean up comment
* PM-5263 - (1) TokenSvc - getEmailVerified - refactor (2) TokenSvc tests - add getEmailVerified tests
* PM-5263 - (1) TokenSvc - refactor getName (2) TokenSvc tests - test getName
* PM-5263 - (1) TokenSvc - refactor getIssuer (2) TokenSvc tests - test getIssuer
* PM-5263 - TokenSvc - remove unnecessary "as type" statements now that we have a decoded access token type
* PM-5263 - (1) TokenSvc - refactor getIsExternal (2) TokenSvc Tests - test getIsExternal
* PM-5263 - TokenSvc abstraction - tune up rest of docs.
* PM-5263 - TokenSvc - clean up promise<any> and replace with promise<void>
* PM-5263 - TokenSvc abstraction - more docs.
* PM-5263 - Clean up TODO as I've tested every method in token svc.
* PM-5263 - (1) Extract JWT decode logic into auth owned utility function out of the token service (2) Update TokenService decode logic to use new utility function (3) Update LastPassDirectImportService + vault.ts to use new utility function and remove token service dependency. (4) Update tests + migrate tests to new utility test file.
* PM-5263 - Rename decodeJwtTokenToJson to decode-jwt-token-to-json to meet lint rules excluding capitals
* PM-5263 - TokenSvc + tests - fix all get methods to return undefined like they did before instead of throwing an error if a user id isn't provided.
* PM-5263 - Services.module - add missing token service dep
* PM-5263 - Update token svc migrations to be 32nd migration
* PM-5263 - Popup - Services.module - Remove token service as it no longer requires a background service due to the migration to state provider. The service definition in jslib-services module is enough.
* PM-5263 - BaseLoginStrategy - Extract email out of getTwoFactorToken method call for easier debugging.
* PM-5263 - Login Comp - Set email into memory on login service so that base login strategy can access user email for looking up 2FA token stored in global state.
* PM-5263 - (1) LoginComp - remove loginSvc.setEmail call as no longer necessary + introduced issues w/ popup and background in browser extension (2) AuthReq & Password login strategies now just pass in email to buildTwoFactor method.
* PM-5263 - SsoLoginSvc + abstraction - Add key definition and get/set methods for saving user email in session storage so it persists across the SSO redirect.
* PM-5263 - Base Login Strategy - BuildTwoFactor - only try to get 2FA token if we have an email to look up their token
* PM-5263 - Remove LoginService dependency from LoginStrategyService
* PM-5263 - (1) Save off user email when they click enterprise SSO on all clients in login comp (2) Retrieve it and pass it into login strategy in SSO comp
* PM-5263 - (1) TokenSvc - update 2FA token methods to be more safe in case user removes record from local storage (2) Add test cases + missing clearTwoFactorToken tests
* PM-5263 - Browser SSO login - save user email for browser SSO process
* PM-5263 - Finish removing login service from login strategy tests.
* PM-5263 - More removals of the login service from the login strategy tests.
* PM-5263 - Main.ts - platformUtilsSvc no longer used in TokenSvc so remove it from desktop main.ts
* PM-5263 - Fix failing login strategy service tests
* PM-5263 - Bump token svc migration values to migration 35 after merging in main
* PM-5263 - Bump token svc migration version
* PM-5263 - TokenService.clearTwoFactorToken - use delete instead of setting values to null per discussion with Justin
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* PM-5263 - TokenSvc + decode JWT token tests - anonymize my information
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* PM-5263 - TokenSvc tests - update clear token tests based on actual deletion
* PM-5263 - Add docs per PR feedback
* PM-5263 - (1) Move ownership of clearing two factor token on rejection from server to base login strategy (2) Each login strategy that supports remember 2FA logic now persists user entered email in its data (3) Base login strategy processTwoFactorResponse now clears 2FA token (4) Updated base login strategy tests to affirm the clearing of the 2FA token
* Update libs/auth/src/common/login-strategies/login.strategy.ts
Co-authored-by: Jake Fink <jfink@bitwarden.com>
* Update libs/auth/src/common/login-strategies/password-login.strategy.ts
Co-authored-by: Jake Fink <jfink@bitwarden.com>
* PM-5263 - Login Strategy - per PR feedback, add jsdoc comments to each method I've touched for this PR.
* PM-5263 - (1) TokenSvc - adjust setTokens, setAccessToken, setRefreshToken, and clearRefreshToken based on PR feedback to remove optional user ids where possible and improve public interface (2) TokenSvc Abstraction - update docs and abstractions based on removed user ids and changed logic (3) TokenSvc tests - update tests to add new test cases, remove no longer relevant ones, and update test names.
* PM-5263 - Bump migrations again
---------
Co-authored-by: Matt Gibson <git@mgibson.dev>
Co-authored-by: Jake Fink <jlf0dev@users.noreply.github.com>
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Co-authored-by: Jake Fink <jfink@bitwarden.com>
Use SafeProvider as a factory for all our providers to ensure
that the DI token, implementation, and deps all match.
---------
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
* create domain settings state provider
* replace callsites for defaultUriMatch and neverDomains with DomainSettingsService equivalents
* replace callsites for equivalentDomains with DomainSettingsService equivalents and clean up unused AccountSettingsSettings
* add migrations for domain settings state
* do not use enum for URI match strategy constants and types
* add getUrlEquivalentDomains test
* PR suggestions/cleanup
* refactor getUrlEquivalentDomains to return an observable
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Co-authored-by: ✨ Audrey ✨ <ajensen@bitwarden.com>
* update tests
* add UriMatchStrategy docs notes
* service class renames
* use service abstraction at callsites previously using service class directly
---------
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Co-authored-by: ✨ Audrey ✨ <ajensen@bitwarden.com>
* add key definition and StrategyData classes
* use state providers for login strategies
* serialize login data for cache
* use state providers for auth request notification
* fix registrations
* add docs to abstraction
* fix sso strategy
* fix password login strategy tests
* fix base login strategy tests
* fix user api login strategy tests
* PM-3339 add tests for admin auth request in sso strategy
* fix auth request login strategy tests
* fix webauthn login strategy tests
* create login strategy state
* use barrel file in common/spec
* test login strategy cache deserialization
* use global state provider
* add test for login strategy service
* fix auth request storage
* add recursive prototype checking and json deserializers to nested objects
* fix CLI
* Create wrapper for login strategy cache
* use behavior subjects in strategies instead of global state
* rename userApi to userApiKey
* pr feedback
* fix tests
* fix deserialization tests
* fix tests
---------
Co-authored-by: rr-bw <102181210+rr-bw@users.noreply.github.com>
* Migrate existing provider data to StateProvider
Migrate existing provider data to StateProvider
* Rework the ProviderService to call StateProvider
* Unit test the ProviderService
* Update DI to reflect ProviderService's new args
* Add ProviderService to logout chains across products
* Remove provider related stateService methods
* Update libs/common/src/state-migrations/migrations/28-move-provider-state-to-state-provider.spec.ts
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* Cover up a copy/paste job
* Compare equality over entire array in a test
---------
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* Revert "[PM-5277] Migrate Sync Service to State Provider (#7680)"
This reverts commit 78008a9e1e.
Includes a noop migration builder that allows us to bridge over the deleted migration
* Prefer revert migrations to noop
this revert avoids the need to change behavior between released vs unreleased migrations and keeps some dangerous code out of the repo :success:
* Update ordering of badge settings migrator to be consistent with `rc`, which was cut with only up to version 25
* Fix missing type import
* Establish biometric unlock enabled in state providers
* Use biometric state service for biometric state values
* Migrate biometricUnlock
* Fixup Dependencies
* linter and import fixes
* Fix injection
* Fix merge
* Use boolean constructor as mapper
* Conform to documented test naming conventions
* Commit documentation suggestion
Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
* Fix merge commit
* Fix test names
---------
Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
* create badge settings state provider
* replace state service get/set disableBadgeCounter with badge settings service equivalent
* migrate disableBadgeCounter account setting to badge settings state provider
* cleanup and address PR suggestions
* create auth request service
* copy methods from auth crypto service
* register new auth request service
* remove refs to auth request crypto service
* remove auth request crypto service
* remove passwordless login method from login strategy service
* add docs to auth request service
* [PM-5679] Capture all form data from page when selecting "New item" even if popout is already open
* [PM-5679] Capture all form data from page when selecting "New item" even if popout is already open
* [PM-5697] Fixing floating promise within the handleExtensionMessage method
* Fix nextMock arguments
* Add state for biometric prompts
* Use biometric state for prompts
* Migrate biometric prompt data
* wire up biometric state to logouts
* Add migrator to migrate list
* Remove usages of prompt automatically
Explicitly list non-nulled state as intentional
* `npm run prettier` 🤖
* Fix web lock component
* create key generation service
* replace old key generation service and add references
* use key generation service in key connector service
* use key generation service in send service
* user key generation service in access service
* use key generation service in device trust service
* fix tests
* fix browser
* add createKeyFromMaterial and tests
* create ephemeral key
* fix tests
* rename method and add returns docs
* ignore material in destructure
* modify test
* specify material as key material
* pull out magic strings to properties
* make salt optional and generate if not provided
* fix test
* fix parameters
* update docs to include link to HKDF rfc
* Create state for biometric client key halves
* Move enc string util to central utils
* Provide biometric state through service
* Use biometric state to track client key half
* Create migration for client key half
* Ensure client key half is removed on logout
* Remove account data for client key half
* Remove unnecessary key definition likes
* Remove moved state from account
* Fix null-conditional operator failure
* Simplify migration
* Remove lame test
* Fix test type
* Add migrator
* Remove state that is never read.
* Remove unnecessary biometric state
We don't need to determine platform in desktop background, it can be done in the UI at any time.
* Fix merge
* Use platform utils to identify OS desktop type
* update collection service to use new state provider framework, remove stateservice from collection service, update collections state provider with migrate file and unit test
* Create MigrationRunner
- Create MigrationRunner Service for running migrations in StateService
- Create web override so that migrations also run against `localStorage`
* Fix Web StateService
* Fix WebMigrationRunner
* Fix CLI
* Fix ElectronStateService
* Update Comment
* More Common Scenarios
* Move libs/exporter into libs/tools/*
Migrating all files from libs/exporter over to libs/tools/export/vault-export/vault-export-core
Rename package to vault-export-core
Fix all file paths
* Update libs and tsconfig imports
* Fix client imports
* Fix eslint, jest and package-lock.json
* Update CODEOWNERS
* Add README.md to whitelist-capital-letters
* Fix vault-export-service tests not running
* Update libs/tools/export/vault-export/README.md
Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com>
* Fix types imports
* Export types from vault-export-core
* Fixed content of README
---------
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com>
* Removed passwordless-login feature flag
* Removed conditional on login component.
* Added back reference accidentally deleted.
* Fixed initialization of the service in tests.
* Removed unused private variable.
* Updated DI to remove configService
* Undid changes to workspace file.
* Undid all changes to workspace file
* Undid merge changes to collection dialog
* Linting
* Begin migration of autofill settings
Co-authored-by: Cesar Gonzalez <cagonzalezcs@users.noreply.github.com>
Co-authored-by: Thomas Avery <Thomas-Avery@users.noreply.github.com>
Co-authored-by: Jonathan Prusik <jprusik@users.noreply.github.com>
Co-authored-by: Colton Hurst <coltonhurst@users.noreply.github.com>
* add browser dependency for AutofillSettingsService
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
* update autofill settings service
* replace usages of stateService get/set autofillOnPageLoad with autofillSettingsService
* replace usages of stateService get/set autofillOnPageLoadDefault with autofillSettingsService
* replace usages of stateService get/set autoCopyTotp with autofillSettingsService
* replace usages of stateService get/set autoFillOnPageLoadCalloutIsDismissed with autofillSettingsService
* replace usages of stateService get/set activateAutoFillOnPageLoadFromPolicy with autofillSettingsService
* replace usages of get/set autoFillOverlayVisibility with autofillSettingsService
* inlineMenuVisibility should use global state
* add the AutofillSettingsService to background scripts
* fix typing
* replace additional usages of get/set autoFillOverlayVisibility and disableAutoTotpCopy with autofillSettingsService equivalents
* replace additional usages of get/set autofillOnPageLoadDefault with autofillSettingsService equivalent
* replace additional usages of get/set activateAutoFillOnPageLoadFromPolicy with autofillSettingsService equivalent
* remove additional deprecated and unused state service calls
* improve naming conventions and consistency
* fix missing mock for policy service test
* replace missing overlay background tests
* cleanup
* fix double inversion
* fix reference to wrong setter
* move handleActivateAutofillPolicy out of BrowserPolicyService
* create state migration script
* resolve linting issues
* remove migrated setting properties
* add AutofillSettingsSErvice to jslib-services
* handle conditional content script loading via autofillOnPageLoad check
* add deprecated note to getFromLocalStorage
* add jsdoc decorators to new autofill service methods
* handle undefined globalState
* move autofill settings out of BrowserPolicyService
* Move autofill settings code out of policyService
* fix tests
* fix typo in state definition
---------
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
Co-authored-by: Cesar Gonzalez <cagonzalezcs@users.noreply.github.com>
Co-authored-by: Thomas Avery <Thomas-Avery@users.noreply.github.com>
Co-authored-by: Colton Hurst <coltonhurst@users.noreply.github.com>
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
* [AC-1124] Add getManyFromApiForOrganization to cipher.service.ts
* [AC-1124] Use getManyFromApiForOrganization when a user does not have access to all ciphers
* [AC-1124] Vault changes
- Show new collection access restricted view
- Include unassigned ciphers for restricted admins
- Restrict collections when creating/cloning/editing ciphers
* [AC-1124] Update edit cipher on page navigation to check if user can access the cipher
* [AC-1124] Hide ciphers from restricted collections
* [AC-1124] Ensure providers are not shown collection access restricted view
* [AC-1124] Modify add-edit component to call the correct endpoint when a restricted admin attempts to add-edit a cipher
* [AC-1124] Fix bug after merge with main
* [AC-1124] Use private this._organization
* [AC-1124] Fix broken builds
* create sso service
* rename sso service to sso-login service
* rename service
* add references to sso login service and update state calls
* fix browser
* fix desktop
* return promises
* remove sso state from account and global objects
* more descriptive org sso identifier method names
* fix sso tests
* fix tests
* added state definition and key definition
* created vault settings service
* created enable passkeys migrations
* created enable passkeys migrations
* renamed the state definition
* created vault settings service
* updated enable passkey key definition
* updated references with vault settings service
* renamed files to avoid conflict
* removed set and get enable passkeys from state service
* removed comment
* fixed comments
* added readonly keyword
* removed service registartion from service module
* removed readonly keyword from abstract class
* swicted to used optional chaining
* renamed files
* added disk-local argument for web
* [PM-5277] Introduce lastSync state via State Providers
* [PM-5277] Add migrator and tests
* [PM-5277] Use memory for web storage location
* [PM-5277] Remove lastSync methods from state service
* [PM-5277] Remove lastSync from AccountProfile
* [PM-5277] Use string instead of Date to fix serialization for chrome.storage API in Browser
* [PM-5277] Only set account if lastSync was deleted during migration
* [PM-5277] Fix spec file
* added state definitionand key definition for folder service
* added data migrations
* created folder to house key definitions
* deleted browser-folder-service and added state provider to the browser
* exposed decrypt function so it can be used by the key definition, updated folder service to use state provider
* removed memory since derived state is now used
* updated test cases
* updated test cases
* updated migrations after merge conflict fix
* added state provider to the folder service constructor
* renamed migration file
* updated comments
* updated comments
* removed service registartion from browser service module and removed unused set and get encrypted folders from state service
* renamed files
* added storage location overides and removed extra methods
* refactor login strategies into own service
* create login service factory
* replaces instances of authService with loginStrategyService
* replace more instances of authService
* move logout back to auth service
* add browser dependencies
* fix desktop dependencies
* fix cli dependencies
* fix lint and test files
* fix anonymous hub deps
* fix webauthn-login service deps
* add loginstrategyservice to bg
* move login strategy service and models to auth folder
* revert changes to tsconfig
* use alias for imports
* fix path
---------
Co-authored-by: rr-bw <102181210+rr-bw@users.noreply.github.com>
* [PM-5368] Open Duo auth url. Add BroadcastChannel listener for duo result.
* [PM-5368] Remove debug line. Use PlatformUtilService to launch Uri.
* PM-5368 - Some progress on getting new frameless duo implementation in place
* PM-5368 - Base2FAComp - Save off duoFramelessUrl for use later on as user must be given the option to remember the device before launching the duo frameless flow in the new tab.
* PM-5368 - Web - 2FA Comp - (1) Only show larger width when showing backwards compatible duo (2) Stack buttons per new design (3) selectedProviderType === providerType.OrganizationDuo is correct check for when org requires DUO
* PM-5368 - Web - 2FA Comp - translate duo stuff
* PM-4613 - Browser 2FA - Get most of DUO frameless in place. WIP. Must figure out how to transfer state from popup to popout + add popout logic to auth-popout-windows.ts. Converted existing useAnotherTwoStepMethod button to use new comp lib bitButton per design.
* PM-4613 - Browser 2FA Comp - (1) HTML - add margin around duo frameless text to match figma (2) Get popout extension logic working properly - now closes existing popup
* PM-4613 - TODO figure out communication between web and browser as broadcast channel will not work.
* PM-5368 - Base comp + web changes - (1) Base component now has a setupDuoResultListener method for child classes to override (2) Web overrides setupDuoResultListener and cleans up broadcast channel once a duo result comes through.
* PM-4613 - Browser - (1) Add window message handling to content-message-handler content script to pass along the duo result message to the browser extension (2) 2FA comp - override setupDuoResultListener and use browserMessagingApi to listen to duoResult and submit when it comes through.
* PM-5368 - Web - 2FA comp - only clean up duo result channel on ngDestroy so that user can re-submit if an error occurs.
* PM-5368 and PM-4613 - (1) Update base 2FA comp to only initialize duo result listener once as init is called any time the user changes 2FA option if multiple are present (duo org and duo personal) (2) Each client now will only create a listener once even if it is called more than once (3) On web, only try to clean up the duoResultChannel if it was created to avoid erroring on other 2FA methods.
* PM-5368 - Base 2FA comp - add TODO to remove duo SDK handling once we remove the duo-redirect flag
* PM-5368 - Per PR feedback, avoid repetition of duo provider check by using a new public property for isDuoProvider
* PM-4613 - Per PR feedback: (1) Deconstruct code out of data (2) Add test for duoResult.
---------
Co-authored-by: André Bispo <abispo@bitwarden.com>
* Create state for biometric client key halves
* Move enc string util to central utils
* Provide biometric state through service
* Use biometric state to track client key half
* Create migration for client key half
* Ensure client key half is removed on logout
* Remove account data for client key half
* Remove unnecessary key definition likes
* Remove moved state from account
* Fix null-conditional operator failure
* Simplify migration
* Remove lame test
* Fix test type
* Add migrator
* Prefer userKey when legacy not needed
* Fix tests
* Got trial page working without the form set up
* Set up the form to create SM subscription
* Add free SM trial page and sign up
* Conner's changes
* fixed imports
* Set isFromSecretsManagerTrial
* Fixed OrgKey location
* Add isFromSecretsManager prop to free org create
* Add LTO callout
* Switch LTO to background box
* Defect: AC-2081
* Fixed typo "Secrets Manger" to "Secrets Manager"
* Removed discount price logic for storage and secrets manager prices since they don't apply
---------
Co-authored-by: Conner Turnbull <133619638+cturnbull-bitwarden@users.noreply.github.com>
Co-authored-by: Conner Turnbull <cturnbull@bitwarden.com>
* Split export service into vault and org export service
* Changed CLI logic to use split export logic
* correct unit tests
* Created individual export service, export service making the calls for org and ind vault
* Improved code readability
* Merged PasswordProtectedExport with Export methods to simplify calls
* Some small refactor
* [AC-1492] Managed collections export (#7556)
* Added managed collections export method
Added logic to show orgs on export that the user can export from
* Merge branch 'tools/AC-1492/split-export-services' into tools/AC-1492/export-flexible-collections
# Conflicts:
# apps/web/src/app/admin-console/organizations/tools/vault-export/org-vault-export.component.ts
# apps/web/src/app/tools/vault-export/export.component.ts
* Change export to use new organization.flexiblecollection flag
* Little refactor changing parameter names and reduzing the size of export.component.ts ngOnInit
* Removed unused service from export constructor and removed unnecessary default value from org export service parameter
* Simplified organizations selection for vault export to only verify if it has flexiblecollections
* removed unecessary services from ExportComponent constructor on popup
* Fixed possible race condition on managed export
* PM-5242 - First working draft of copying out web CL implementation of user verification form and dialog components into standalone libs/auth components which could be used in any client.
* PM-5242 - Rename UserVerificationFormComponent to UserVerificationFormInputComponent b/c it doesn't actually have a form and is meant to slot into a form as an input.
* PM-5242 - Update libs/auth angular index to take renamed component into account
* PM-5242 - Clean up UserVerificationDialogComponent as have much cleaner design approach now (maintain existing func while simply adding new requirements for client side validation for passkeys)
* PM-5242 - UserVerificationFormInput component - WIP draft of new client and server split of user verification logic
* PM-5242 - UserVerificationFormInput - WIP - Lots of progress on client side verification layout - more to do
* PM-5242 - UserVerificationFormInputComponent - Add hasMultipleVerificationMethods property so we can only show alternate methods if user has them.
* PM-5242 - UserVerificationFormInputComponent - rename hasMultipleVerificationMethods to hasMultipleClientVerificationOptions
* PM-5242 - Add new user verification biometrics fingerprint icon with proper secondary fill so it displays properly on all themes.
* PM-5242 - Create enum for tracking client user verification states
* PM-5242 - UserVerificationFormInputComponent - WIP - (1) Got biometrics layout working except for error state (2) Emitting active client verification option and biometrics result to dialog (3) Properly identifying if biometrics is enabled in a platform agnostic way (4) Translations TODO
* PM-5242 - UserVerificationDialogComponent - (1) Wire up new inputs and outputs for UserVerificationFormInput (2) Don't show submit button when clientside biometrics verification active
* PM-5242 - UserVerificationFormInputComponent - wired up biometrics failure and retry handling + re-arranged comp properties to put inputs & outputs at the top
* PM-5242 - UserVerificationFormInput component - Add logic to prevent currently active client verification method from being shown an option
* PM-5242 - UserVerificationFormInput - adjust margins
* PM-5242 - User verification dialog and form input comps - replace Verification with VerificationWithSecret type where applicable
* PM-5242 - UserVerificationFormComp - Default to server for backwards compatibility and to avoid requiring the input at all
* PM-5242 - UserVerificationFormInputComp - (1) Rename processChanges to processSecretChanges (2) Short circuit processSecretChanges when biometrics is active (3) Add new function for determining type of verification that has a secret.
* PM-5242 - UserVerificationDialog - Support custom, optional callout in dialog body.
* PM-5242 - UserVerificationDialogComp - support custom confirm button text and type.
* PM-5242 - UserVerificationDialog - Add user verification dialog result type to allow for handling all possible verification scenarios
* PM-5242 - UserVerificationFormInputComp - tweak comment
* PM-5242 - UserVerificationFormInput comp html - add placeholder text for no client verifications found scenario
* PM-5242 - UserVerificationDialogComponent - (1) Add confirm & cancel to dialog result (2) Add cancel method vs using bitDialogClose for specificity (3) Adjust naming of output property to properly specify that it is scoped to client verification (4) Adjust layout of dialog html to handle when no client side verification methods are found.
* PM-5242 - UserVerificationFormInput - Clean up test code
* PM-5242 - UserVerificationFormInput - For server verification, we don't need to check if the user has a local master key hash as we will generate a hash to send to the server for comparison.
* PM-5242 - UserVerificationFormInput html - Remove now unnecessary dev warning as I've provided a default
* PM-5242 - UserVerification Dialog & Form Input - add translations on all clients for all visible text.
* PM-5242 - UserVerificationFormInput html - remove no active client verification handling from form input comp as it is instead emitted upwards to parent dialog component to be handled there.
* PM-5242 - UserVerificationDialogComp - (1) Make UserVerificationDialogResult.noAvailableClientVerificationMethods optional because it isn't needed in cancel flows (thanks Will) (2) Modify static open to intercept closed observable event in order to always return a UserVerificationDialogResult as BitDialog returns empty string when the user clicks the x
* PM-5242 - UserVerificationDialogComp - Simplify dialog param names to remove redundant dialog
* PM-5242 - UserVerificationDialogParams - update comments to match new names
* PM-5242 - UserVerificationDialog Storybook - WIP first draft
* PM-5242 - UserVerificationDialogStoryComponent - WIP - try out having imports the same as the standalone component
* PM-5242 - UserVerificationDialogStoryComponent - more WIP - building now - some stuff displaying
* PM-5242 - UserVerificationDialogStoryComponent - some progress on providers setup
* PM-5242 - Not going to use storybook for user verification dialog
* PM-5242 - UserVerificationDialogComp - move types into own file + add docs
* PM-5242 - Update auth index to export user-verification-dialog.types
* PM-5242 - UserVerificationFormInput & UserVerificationService - Extract out getAvailableVerificationOptions logic into service
* PM-5242 -UserVerificationDialogComponent - Update close logic to handle escape key undefined scenario
* PM-5242 - UserVerificationFormInput - add getInvalidSecretErrorMessage for properly determining invalid secret translation
* PM-5242 - UserVerificationDialogComp - Refactor submit logic to handle different return methodologies in existing MP and OTP user verification service code vs new PIN flow (e.g., throwing an error instead of returning false)
* PM-5242 - PinCryptoService - change error logs to warnings per discussion with Justin
* PM-5242 - UserVerificationFormInput - Biometrics flow on desktop - remove accidentally added period in couldNotCompleteBiometrics translation key.
* PM-5242 - UserVerificationFormInput HTML - Re-arrange order of other client verification options to match design
* PM-5242 - UserVerificationFormInputComponent - Reset inputs as untouched on change of client verification method.
* PM-5242 - UserVerificationDialogComponent - Remove TODO as existing secret change logic turns invalidSecret false when biometrics is swapped to.
* PM-5242 - UserVerificationFormInputComponent - getInvalidSecretErrorMessage - fix PIN error message not being returned.
* PM-5242 - UserVerificationDialogComponent - Add documentation and examples to open method.
* PM-5242 - UserVerificationDialogComponent - tweak open docs
* PM-5242 - Remove accidental period from translation keys on browser & web
* PM-5242 - UserVerificationFormInputComponent - OTP flow needed button module to work
* PM-5242 - UserVerificationDialogParams - Add docs explaining that noAvailableClientVerificationMethods is only for desktop & browser.
* PM-5242 - User-verification-form-input - Adjust layout to meet new design requirements - (1) On load, send OTP without user clicking a button (2) Allow resending of the codes (3) show a code sent message for 3 seconds
* PM-5242 - Browser User Verification - Instantiate PinCryptoService and UserVerification service AFTER instantiating vaultTimeoutSettingsService so that it isn't undefined at run time.
* PM-5242 - JslibServices Module - UserVerificationService - add missing PlatformUtilsServiceAbstraction dependency.
* PM-5242 - Desktop Native Messaging Service - Wrap biometric getUserKeyFromStorage call in try catch because it throws an error if the user cancels the biometrics prompt and doesn't send a response to the browser extension when using the biometrics unlock bridge to the desktop app and OS.
* PM-5242 - Browser Extension - NativeMessagingBackground - if the desktop biometricUnlock command is executed with a canceled (not adjusting misspelling to keep side effects at a min) response, don't bother continuing.
* PM-5242 - BrowserCryptoService - When retrieving the user key via desktop biometrics, return null for user key if the user fails or cancels the biometrics prompt. Otherwise, if there is a user key in memory after unlock, biometrics user verification will always just return the user key from state regardless of if the user has successfully passed the biometrics prompt or not.
* PM-5242 - BrowserCryptoService - extra comments
* PM-5242 - Clean up translations - (1) Remove unused defaultUserVerificationDialogConfirmBtnText (2) Refactor name of defaultUserVerificationDialogTitle to just be verificationRequired which matches existing naming conventions.
* PM-5242 - CLI - fix order of service instantiations to ensure that vaultTimeoutSettingsService isn't undefined for PinCryptoService and UserVerificationService
* PM-5242 - Rename UserVerificationDialogParams to UserVerificationDialogOptions to match existing naming conventions of other CL comps.
* PM-5242 - UserVerificationDialogComponent - dialogParams renamed to dialogOptions
* PM-5242 - UserVerificationService Abstraction - Per PR feedback, use keyof for verificationType
* PM-5242 - UserVerificationBiometricsIcon - Per PR feedback, use https://jakearchibald.github.io/svgomg/ to optimize SVG by 50%.
* PM-5242 - Per PR feedback, clarify UserVerificationDialogOptions.clientSideOnlyVerification comment.
* PM-5242 - UserVerificationTypes - Add comments clarifying all text passed to the UserVerificationDialog are translation keys
* PM-5242 - UserVerificationDialogComp - fix extra new line per PR feedback
* PM-5242 - UserVerificationDialogTypes - per PR feedback and discussion with Will M., export ButtonType from CL so we (and consumers of the dialog) can properly import it via standard CL import.
* PM-5242 - BrowserCryptoService - Adjust comments per PR feedback.
* PM-5242 - UserVerificationDialogComponent - make ActiveClientVerificationOption readonly as it only for component html
* PM-5242 - UserVerificationDialogComp html - finish comment
* PM-5242 - BrowserCryptoService - add returns js doc per PR feedback.
* PM-5242 - UserVerificationDialogComponent - per PR feedback, add unexpected error toast.
* PM-5242 - UserVerificationService - getAvailableVerificationOptions - update params to use keyof like abstraction
* PM-5242 - Mark all existing client specific implemetations of user verification as deprecated.
* Add `disk-local` option for web
* Fix `web` DI
* Update libs/common/src/platform/state/state-definition.ts
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
* Rely On Default Implementation for Most of Cache Key
---------
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
* add flag to deter process reload if cancel is clicked on biometrics
* rename flag
* store biometrics cancelled to disk instead of integrating with process reload
* allow auto-prompt when opening app
* PM-4596 - PinCryptoService first draft
* PM-4596 - PinCryptoService - Refactor pinKeyEncryptedKey retrievals out into own method getPinKeyEncryptedKeys
* PM-4596 - npm ci + npm run prettier to fix lint issues
* PM-4596 - PinCryptoService - Add kdf types
* PM-4596 - PinCryptoService - Refactor pin validation into own helper method.
* PM-4596 - Rename pin-crypto.service.ts to pin-crypto.service.implementation.ts
* PM-4596 - PinCryptoService - add additional logging for error states.
* PM-4596 - JslibServicesModule - register new PinCryptoService and PinCryptoServiceAbstraction
* PM-4596 - PinCryptoService - modify decryptUserKeyWithPin signature to not require email to match MP verification process in user verification service.
* PM-4596 - Lock components - use new PinCryptoService.decryptUserKeyWithPin(...) to get user key + refactor base comp unlock with pin method to improve
* PM-4596 - Lock component - if too many invalid attempts, added toast explaining that we were logging the user out due to excess PIN entry attempts
* PM-4596 - UserVerificationService - (1) Refactor verifyUser(...) to use switch + separate methods for a cleaner parent method + better extensibility for PIN & biometrics which are TBD (2) Add PIN support to validateInput(...)
* PM-4596 - UserVerificationService - add PIN and biometrics functions to verifyUser(...)
* PM-4596 - PinCryptoService Spec - start test file - instantiates properly
* PM-4596 - PinCryptoService tests - WIP
* PM-4596 - PinCryptoService tests - WIP - got success cases working
* PM-4596 - pin-crypto.service.implementation.spec.ts renamed to pin-crypto.service.spec.ts
* PM-4596 - PinCryptoService.getPinKeyEncryptedKeys(...) - add comment + var name change for clarity
* PM-4596 - PinCryptoService tests - test invalid, null return scenarios
* PM-4596 - CLI - bw.ts - update UserVerificationService instantiation to include new pinCryptoService
* PM-4596 - PinCryptoService - import VaultTimeoutSettingsServiceAbstraction instead of implementation for factory creation to get browser building
* PM-4596 - (1) Create pinCryptoServiceFactory for browser background (2) Add it to the existing userVerificationServiceFactory
* PM-4596 - Browser - Main.background.ts - Add pinCryptoService and add to userVerificationService dependencies
* PM-4596 - UserVerificationService - per PR feedback simplify returns of verifyUserByPIN(...) and verifyUserByBiometrics(...)
* PM-4596 - Messages.json on desktop & browser - per PR feedback, adjust tooManyInvalidPinEntryAttemptsLoggingOut translation text to remove "you"
* PM-4596 - VerificationType enum - fix line copy mistake and give BIOMETRICS own, unique value.
* PM-4596 - VerificationType - rename BIOMETRICS to Biometrics to match existing MasterPassword value case.
* PM-4596 - Update verification type to consider whether or not a secret exists as we have added a new verification which doesn't have a type. Add new server and client side verification types. Update all relevant code to pass compilation checks.
* PM-4596 - More verification type tweaking
* PM-4596 - Verification - verificationHasSecret - tweak logic to be more dynamic and flexible for future verification types
* PM-4596 - UpdateTempPasswordComp - use new MasterPasswordVerification
* PM-4596 - Desktop - DeleteAcctComp - use VerificationWithSecret to solve compile error w/ accessing secret
* PM-4596 - Per discussions with Andreas & Will, move new Pin Crypto services into libs/auth + added @bitwarden/auth path to CLI tsconfig + added new, required index.ts files for exporting service abstractions & implementations
* PM-4596 - Fixed missed import fixes for lock components across clients for pin crypto service after moving into @bitwarden/auth
* PM-4596 - More PinCryptoService import fixes to get browser & desktop building
* PM-4596 - Update desktop lock comp tests to pass by providing new pin crypto service.
* PM-4596 - User verification service -update todo
* PM-4596 - PinCryptoService - per PR feedback, fix auto import wrong paths.
* PM-4596 - PinCryptoService tests - fix imports per PR feedback
* PM-4596 - UserVerificationSvc - rename method to validateSecretInput per PR feedback
* Fix imports
* PM-4596 - PinCryptoService - Refactor naming for clarity and move test cases into describes per PR feedback
* reorg libs/auth; expose only libs/auth/core to cli app
* PM-4596 - UserVerification - Resolve import issue with importing from libs/auth. Can't use @bitwarden/auth for whatever reason.
* PM-4596 - Fix desktop build by fixing import
* PM-4596 - Provide PinCryptoService to UserVerificationService
* PM-4596 - PinCryptoServiceFactory - you cannot import services from @bitwarden/auth in the background b/c it brings along the libs/auth/components and introduces angular into the background context which doesn't have access to angular which causes random test failures. So, we must separate out the core services just like the CLI to only bring along the angular agnostic services from core.
* PM-4596 - Refactor libs/auth to have angular / common + update all imports per discussion with Matt & Will. Introduced circular dep between PinCryptoService + VaultTimeoutSettingsService + UserVerificationService
* PM-4596 - VaultTimeoutSettingsService - Refactor UserVerificationService out of the service and update all service instantiations and tests. The use of the UserVerificationService.hasMasterPassword method no longer needs to be used for backwards compatibility. This resolves the circular dependency between the PinCryptoService, the UserVerificationService, and the VaultTimeoutSettingsService. We will likely refactor the hasMasterPassword method out of the UserVerificationService in the future.
* PM-4596 - Update CL tsconfig.libs.json to add new auth/common and auth/angular paths for jslib-services.module imports of pin crypto service to work and for test code coverage to run successfully.
* PM-4596 - Address PR feedback
* PM-4596 - Update root tsconfig (only used by storybook) to add new libs/auth paths to fix chromatic build pipeline.
* PM-4596 - Actually update tsconfig with proper routes to fix storybook
* PM-4596 - UserVerificationService - verifyUserByBiometrics - add error handling logic to convert failed or cancelled biometrics verification to a usable boolean
* PM-4596 - Add missing await
* PM-4596 - (1) Add log service and log to user verification service biometric flow to ensure errors are at least revealed to the console (2) Fix factory missing PinCryptoServiceInitOptions
* PM-4596 - Use the correct log service abstraction
* PM-4596 - Remove unused types per PR review
---------
Co-authored-by: William Martin <contact@willmartian.com>
* PoC disallow changing masked values in edit mode and mask TOTP with password
* toggle totp seed visibility independently from password visibility in edit mode
* cleanup
* add fallback value for when a cipher returns a null value for maskedPassword
* toggle masks off for maskable login properties with no value on load
* do not show mask toggle for password or totp if no value is present
appAutofocus currently doesn't work on the bit-search component. This PR resolves this issue by introducing a FocusableElement interface components can implement, which is respected by the autofocus directive.