* 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
* 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
* 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>
* 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>
* Change passphrase generator's default wordSeparator to the empty string ''
* Create DefaultPassphraseGenerationOptions
* Use DefaultPassphraseGenerationOptions.wordSeparator in passphrase generation
* Add `empty` separator option to passphrase generator CLI and an example
* Change DefaultPassphraseGenerationOptions numWords to 3
* Use `DefaultPassphraseGenerationOptions.numWords` in CLI passphrase gen
* Wire up key definitions for OrganizationService
[`AC-2009`: Transition OrganizationService to use StateProvider](
https://bitwarden.atlassian.net/browse/AC-2009)
In order to support the new `StateProvider` APIs for managing
application state this commit modifies `OrganizationService` in the following
ways:
1. Adding a `KeyDefinition` object to `OrganizationService` to store the
`organization` record in `StateProvider`.
1. Injecting `StateProvider` and wiring up `OrganizationService` to read
from the `organizations` key definition for the active user account.
1. Expanding the capabilities of `OrganizationData` to be able to read
itself from a JSON string. Previously this was handled directly by
`StateService`.
1. Updating tests to include requirements for testing against
`StateProvider`.
1. Marking the existing `StateService`-backed `organizations`
`Observable` and `BehaviorSubject` as deprecated.
This is largely unimplemented code with no intended visible effects to
the system. Implementing getting & updating the `organizations` value
from `StateProvider` will the next step in this work.
* Rework null check on OrganizationData
* Remove deprecation signals for the time being
* Move key definition inline with its service
* Create date objects when deserialzing json from state
* [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>
* 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.
* 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>
* Migrate ever had user key
* Add DI for state providers
* Add state for everHadUserKey
* Use ever had user key migrator
Co-authored-by: SmithThe4th <gsmithwalter@gmail.com>
Co-authored-by: Carlos Gonçalves <LRNcardozoWDF@users.noreply.github.com>
Co-authored-by: Jason Ng <Jcory.ng@gmail.com>
* Fix test from merge
* Prefer stored observables to getters
getters create a new observable every time they're called, whereas one set in the constructor is created only once.
* Fix another merge issue
* Fix cli background build
---------
Co-authored-by: SmithThe4th <gsmithwalter@gmail.com>
Co-authored-by: Carlos Gonçalves <LRNcardozoWDF@users.noreply.github.com>
Co-authored-by: Jason Ng <Jcory.ng@gmail.com>
* Remove derived state from state classes
* Create provider for derived state
Derived state is automatically stored to memory storage, but can be derived from any observable.
* Fixup state provider method definitions
* Test `DefaultDerivedState`
* remove implementation notes
* Write docs for derived state
* fixup derived state provider types
* Implement buffered delayUntil operator
* Move state types to a common module
* Move mock ports to centra location
* Alias DerivedStateDependency type
* Add dependencies to browser
* Prefer internal rxjs operators for ref counting
* WIP
* Ensure complete on subjects
* Foreground/background messaging for browser
Defers work for browser to the background
* Test foreground port behaviors
* Inject foreground and background derived state services
* remove unnecessary class field
* Adhere to required options
* Add dderived state to CLI
* Prefer type definition in type parameters to options
* Prefer instance method
* Implements factory methods for common uses
* Remove nothing test
* Remove share subject reference
Share manages connector subjects internally and will reuse them until
refcount is 0 and the cleanup time has passed. Saving our own reference
just risks memory leaks without real testability benefits.
* Fix interaction state
* [AC-1139] Add new layout for MemberDialogComponent when FC feature flag is enabled
* [AC-1139] Deprecated Organization canEditAssignedCollections, canDeleteAssignedCollections, canViewAssignedCollections
* [AC-1139] Checking if FC feature flag is enabled when using canDeleteAssignedCollections or canViewAssignedCollections
* [AC-1139] Added missing parameter to customRedirect
* [AC-1139] Fixed canEdit permission
* [AC-1139] Fixed CanDelete logic
* [AC-1139] Changed canAccessVaultTab function to receive configService
* Override deprecated values on sync
* [AC-1139] Reverted change that introduced ConfigService as a parameter to canAccessVaultTab
* [AC-1139] Fixed circular dependency
* [AC-1139] Moved overriding of deprecated values to syncService
* Revert "[AC-1139] Fixed circular dependency"
This reverts commit 6484420976.
* Revert "Override deprecated values on sync"
This reverts commit f0c25a6996.
* [AC-1139] Added back the deprecation of methods canEditAssignedCollections, canDeleteAssignedCollections, canViewAssignedCollections
* [AC-1139] Reverted change on syncService
* [AC-1139] Override deprecated values on sync
* [AC-1139] Fix canDelete logic in
collection-dialog.component.ts and
bulk-delete-dialog.component.ts
* [AC-1139] Moved override logic from syncService to organizationService
* [AC-1139] Add ability to have titlecase titles on nested-checkbox.component checkboxes; use on member-dialog.component
* Revert "[AC-1139] Add ability to have titlecase titles on nested-checkbox.component checkboxes; use on member-dialog.component"
This reverts commit 9ede0fc5ac.
* [AC-1139] Fix bulk delete functionality
* [AC-1139] Refactor canEdit and canDelete to use ternary operator
* [AC-1139] Fix canDelete condition in VaultComponent
---------
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
Assign ownership to many of the remaining libs/common files.
Criteria for ownership:
* Files used by a single team, is now owned by that team.
* Files related to a domain owned by a team is now owned by that team.
* Where ownership is unclear the "lowest level" service takes ownership.
* Allow for update logic in state update callbacks
* Prefer reading updates to sending in stream
* Inform state providers when they must deserialize
* Update DefaultGlobalState to act more like DefaultUserState
* Fully Implement AbstractStorageService
* Add KeyDefinitionOptions
* Address PR feedback
* Prefer testing interactions for ports
* Synced memory storage for browser
* Fix port handling
* Do not stringify port message data
* Use messaging storage
* Initialize new foreground memory storage services
This will need to be rethought for short-lived background pages, but for
now the background is the source of truth for memory storage
* Use global state for account service
* Use BrowserApi listener to avoid safari memory leaks
* Fix build errors: debugging and missed impls
* Prefer bound arrow functions
* JSON Stringify Messages
* Prefer `useClass`
* Use noop services
* extract storage observable to new interface
This also reverts changes for the existing services to use
foreground/background services. Those are now used only in state
providers
* Fix web DI
* Prefer initializing observable in constructor
* Do not use jsonify as equality operator
* Remove port listener to avoid memory leaks
* Fix logic and type issues
---------
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* Allow for update logic in state update callbacks
* Prefer reading updates to sending in stream
* Inform state providers when they must deserialize
* Update DefaultGlobalState to act more like DefaultUserState
* Fully Implement AbstractStorageService
* Add KeyDefinitionOptions
* Address PR feedback
* More Descriptive Error
---------
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* Add StateDefinition
Add a class for encapsulation information about state
this will often be for a domain but creations of this will
exist outside of a specific domain, hence just the name State.
* Add KeyDefinition
This adds a type that extends state definition into another sub-key
and forces creators to define the data that will be stored and how
to read the data that they expect to be stored.
* Add key-builders helper functions
Adds to function to help building keys for both keys scoped
to a specific user and for keys scoped to global storage.
Co-authored-by: Matt Gibson <MGibson1@users.noreply.github.com>
* Add updates$ stream to existing storageServices
Original commit by Matt: 823d9546fe
Co-authored-by: Matt Gibson <MGibson1@users.noreply.github.com>
* Add fromChromeEvent helper
Create a helper that creats an Observable from a chrome event
and removes the listener when the subscription is completed.
* Implement `updates$` property for chrome storage
Use fromChromeEvent to create an observable from chrome
event and map that into our expected shape.
* Add GlobalState Abstractions
* Add UserState Abstractions
* Add Default Implementations of User/Global state
Co-authored-by: Matt Gibson <MGibson1@users.noreply.github.com>
* Add Barrel File for state
Co-authored-by: Matt Gibson <MGibson1@users.noreply.github.com>
* Fix ChromeStorageServices
* Rework fromChromeEvent
Rework fromChromeEvent so we have to lie to TS less and
remove unneeded generics. I did this by caring less about
the function and more about the parameters only.
Co-authored-by: Matt Gibson <MGibson1@users.noreply.github.com>
* Fix UserStateProvider Test
* Add Inner Mock & Assert Calls
* Update Tests to use new keys
Use different key format
* Prefer returns over mutations in update
* Update Tests
* Address PR Feedback
* Be stricter with userId parameter
* Add Better Way To Determine if it was a remove
* Fix Web & Browser Storage Services
* Fix Desktop & CLI Storage Services
* Fix Test Storage Service
* Use createKey Helper
* Prefer implement to extending
* Determine storage location in providers
* Export default providers publicly
* Fix user state tests
* Name tests
* Fix CLI
* Prefer Implement In Chrome Storage
* Remove Secure Storage Option
Also throw an exception for subscribes to the secure storage observable.
* Update apps/browser/src/platform/browser/from-chrome-event.ts
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
* Enforce state module barrel file
* Fix Linting Error
* Allow state module import from other modules
* Globally Unregister fromChromeEvent Listeners
Changed fromChromeEvent to add its listeners through the BrowserApi, so that
they will be unregistered when safari closes.
* Test default global state
* Use Proper Casing in Parameter
* Address Feedback
* Update libs/common/src/platform/state/key-definition.ts
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
* Add `buildCacheKey` Method
* Fix lint errors
* Add Comment
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
* Use Generic in callback parameter
* Refactor Out DerivedStateDefinition
* Persist Listener Return Type
* Add Ticket Link
---------
Co-authored-by: Matt Gibson <MGibson1@users.noreply.github.com>
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
* PM-3275 - Policy.service - Refactor existing mapPoliciesFromToken internal logic to provide public mapPolicyFromResponse method
* PM-3275 - Add new PolicyApiService.getMasterPasswordPolicyOptsForOrgUser method for use in the set password comp
* PM-3275 - Update set-password.comp to use new policyApiService.getMasterPasswordPoliciesForInvitedUsers method
* PM-3275 - (1) Remove post TDE AuthN set password routing logic from SSO/2FA comps as we cannot set an initial user password until after decryption in order to avoid losing the ability to decrypt existing vault items (a new user key would be created if one didn't exist in memory) (2) Add set password routing logic post TDE decryption in LoginWithDevice/Lock components (3) Add new ForceResetPasswordReason to capture this case so that we can guard against users manually navigating away from the set password screen
* PM-3275 - SyncSvc - Add logic for setting forcePasswordReset reason if TDE user w/out MP went from not having MP reset permission to having it.
* PM-3275 - Rename ForceResetPasswordReason enum to ForceSetPasswordReason + update all references.
* PM-3275 - Removing client deprecated calls to getPoliciesByInvitedUser and helper call getMasterPasswordPoliciesForInvitedUsers
* PM-3275 - PolicyAPI service - remove no longer necessary getPoliciesByInvitedUser method
* PM-3275 - LockComp - TODO cleanup
* PM-3275 - SSO & 2FA comp - cleanup of incorrect routing path
* PM-3275 - (1) State service refactor - change getForcePasswordResetReason / setForcePasswordResetReason to be getForceSetPasswordReason / setForceSetPasswordReason (2) Sync Service - encapsulate setForceSetPasswordReasonIfNeeded logic into own method
* PM-3275 - SetPassword Comp - Rename "identifier" to be "orgSsoIdentifier" for clarity
* PM-3275 - SetPasswordComp - Moving routing from SSO / 2FA comps to Lock / LoginWithDevice comps results in a loss of the the OrgSsoId. However, as part of the TDE work, we added the OrgSsoId to state so use that as a fallback so we can accurately evaluate if the user needs to be auto enrolled in admin account recovery.
* PM-3275 - SetPasswordComp - add a bit more context to why/when we are reading the user org sso id out of state
* PM-3275 - SetPassword Comp - (1) Add forceSetPasswordReason and ForceSetPasswordReason enum as public props on the class so we can change copy text based on which is set + set forceSetPasswordReason on ngOnInit (2) Refactor ngOnInit to use a single RxJs observable chain for primary logic as the auto enroll check was occurring before the async getUserSsoOrganizationIdentifier could finish.
* PM-3275 - Desktop - App comp - missed replacing getForcePasswordResetReason with getForceSetPasswordReason
* PM-3275 - TDE Decryption Option Comps - must set ForceSetPasswordReason so that we can properly enforce keeping the user on the component + display the correct copy explaining the scenario to the user.
* PM-3275 - All Clients - SetPasswordComp html - Update page description per product + remove no longer used ssoCompleteRegistration translation.
* PM-3275 - SetPasswordComp - hopefully the final puzzle piece - must clear ForceSetPasswordReason in order to let user navigate back to vault.
* PM-3275 - SyncService - Remove check for previous value of account decryption options hasManageResetPasswordPermission as when a user logged in on a trusted device after having their permissions updated, the initial setting would be true and it would cause the flag to NOT be set when it should have.
* PM-3275 - TDE User Context - (1) Remove explicit navigation to set password screen from post decryption success scenarios on lock & login w/ device comps (2) Move TdeUserWithoutPasswordHasPasswordResetPermission flag setting to SSO / 2FA components to support both trusted and untrusted device scenarios (both of which are now caught by the auth guard).
* PM-3275 - (1) SetPassword comp - adjust set password logic for TDE users to avoid creating a new user asymmetric key pair and setting a new private key in memory. (2) Adjust SetPasswordRequest to allow null keys
* PM-3275 - Remove unused route from login with device comp
* PM-3275 - Sso & 2FA comp tests - Update tests to reflect new routing logic when TDE user needs to set a password
* PM-3275 - Lock comp - per PR feedback, remove unused setPasswordRoute property.
* PM-3275 - SetPasswordComp - Per PR feedback, use explicit null check
* PM-3275 - Per PR Feedback, rename missed forcePasswordResetReason to be forceSetPasswordReason on account model
* PM-3275 - Auth guard - rename forcePasswordResetReason to forceSetPasswordReason
* PM-3275 - SSO / 2FA comps - Per PR feedback, refactor Admin Force Password reset handling to be in one place above the TDE user flows and standard user flows as it applies to both.
* PM-3275 - Per PR feedback, clarify 2FA routing comment
* PM-3275 - Per PR feedback, update set-password comp ngOnInit switchMaps to just return promises as switchMap converts promises to observables internally.
* PM-3275 - Per PR feedback, refactor set password ngOnInit observable chain to avoid using async subscribe and instead simply sequence the calls via switchMap and tap for side effects.
* PM-3275 - Per PR feedback, move tap after filter so we can remove if check
* PM-3275 - Per PR feedback, update policy service mapping methods to use shorthand null checking.
* PM-3275 - SetPassword comp - (1) Move force set password reason logic into onSetPasswordSuccess(...) (2) On onSetPasswordSuccess, must set hasMasterPassword to true for user verification scenarios.
* PM-3275 - Per PR feedback, remove new hasManageResetPasswordPermission flag from profile response and instead simply read the information off the existing profile.organizations data as the information I needed was already present.
* PM-4633 - PolicyService - mapPolicyFromResponse(...) - remove incorrect null check for data. Policies with internal null data property should still be evaluated and turned into Policy objects or the policy array ends up having null values in it and it causes errors down the line on login after acct creation.
* Noop notifications for dev
We rarely have notifications set up for development environments, this
removes the error messages related to missing server notification
services
* Log actions in noop service
* Add line breaks
* Improve log messages
* Ignore local config at all levels
* Define account service observable responsibilities
* Establish account service observables and update methods
* Update Account Service observables from state service
This is a temporary stop-gap to avoid needing to reroute all account
activity and status changes through the account service. That can be
done as part of the breakup of state service.
* Add matchers for Observable emissions
* Fix null active account
* Test account service
* Transition account status to account info
* Remove unused matchers
* Remove duplicate class
* Replay active account for late subscriptions
* Add factories for background services
* Fix state service for web
* Allow for optional messaging
This is a temporary hack until the flow of account status can be
reversed from state -> account to account -> state. The foreground
account service will still logout, it's just the background one cannot
send messages
* Fix add account logic
* Do not throw on recoverable errors
It's possible that duplicate entries exist in `activeAccounts` exist
in the wild. If we throw on adding a duplicate account this will cause
applications to be unusable until duplicates are removed it is not
necessary to throw since this is recoverable. with some potential loss
in current account status
* Add documentation to abstraction
* Update libs/common/spec/utils.ts
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* Fix justin's comment :fist-shake:
---------
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* Split up import/export into separate modules
* Fix routing and apply PR feedback
* Renamed OrganizationExport exports to OrganizationVaultExport
* Make import dialogs standalone and move them to libs/importer
* Make import.component re-usable
- Move functionality which was previously present on the org-import.component into import.component
- Move import.component into libs/importer
Make import.component standalone
Create import-web.component to represent Web UI
Fix module imports and routing
Remove unused org-import-files
* Renamed filenames according to export rename
* Make ImportWebComponent standalone, simplify routing
* Pass organizationId as Input to ImportComponent
* use formLoading and formDisabled outputs
* Emit an event when the import succeeds
Remove Angular router from base-component as other clients might not have routing (i.e. desktop)
Move logic that happened on web successful import into the import-web.component
* fix table themes on desktop & browser
* fix fileSelector button styles
* update selectors to use tools prefix; remove unused selectors
* Wall off UI components in libs/importer
Create barrel-file for libs/importer/components
Remove components and dialog exports from libs/importer/index.ts
Extend libs/shared/tsconfig.libs.json to include @bitwarden/importer/ui -> libs/importer/components
Extend apps/web/tsconfig.ts to include @bitwarden/importer/ui
Update all usages
* Rename @bitwarden/importer to @bitwarden/importer/core
Create more barrel files in libs/importer/*
Update imports within libs/importer
Extend tsconfig files
Update imports in web, desktop, browser and cli
* Lazy-load the ImportWebComponent via both routes
* Use SharedModule as import in import-web.component
* File selector should be displayed as secondary
* Use bitSubmit to override submit preventDefault (#6607)
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
---------
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Co-authored-by: William Martin <contact@willmartian.com>
* PM-1049 - TODO: replace base component with business service
* updated server version
* disabled cipher key encryption
* add new storage to replace MasterKey with UserSymKey
* add storage for master key encrypted user symmetric key
* Begin refactor of crypto service to support new key structure
* remove provided key from getKeyForUserEncryption
* add decryption with MasterKey method to crypto service
* update makeKeyPair on crypto service to be generic
* add type to parameter of setUserKey in abstraction of crypto service
* add setUserSymKeyMasterKey so we can set the encrypted user sym key from server
* update cli with new crypto service methods
- decrypt user sym key and set when unlocking
* separate the user key in memory from user keys in storage
* add new memory concept to crypto service calls in cli
* update auth service to use new crypto service
* update register component in lib to use new crypto service
* update register component again with more crypto service
* update sync service to use new crypto service methods
* update send service to use new crypto service methods
* update folder service to use new crypto service methods
* update cipher service to use new crypto service
* update password generation service to use new crypto service
* update vault timeout service with new crypto service
* update collection service to use new crypto service
* update emergency access components to use new crypto service methods
* migrate login strategies to new key model
- decrypt and set user symmetric key if Master Key is available
- rename keys where applicable
- update unit tests
* migrate pin to use user's symmetric key instead of master key
- set up new state
- migrate on lock component
- use new crypto service methods
* update pin key when the user symmetric key is set
- always set the protected pin so we can recreate pin key from user symmetric key
- stop using EncryptionPair in account
- use EncString for both pin key storage
- update migration from old strategy on lock component
* set user symmetric key on lock component
- add missed key suffix types to crypto service methods
* migrate auto key
- add helper to internal crypto service method to migrate
* remove additional keys in state service clean
* clean up the old pin keys in more flows
- in the case that the app is updated while logged in and the user changes their pin, this will clear the old pin keys
* finish migrate auto key if needed
- migrate whenever retrieved from storage
- add back the user symmetric key toggle
* migrate biometrics key
- migrate only on retrieval
* fix crypto calls for key connector and vault timeout settings
* update change password components with new crypto service
* update assortment of leftover old crypto service calls
* update device-crypto service with new crypto service
* remove old EncKey methods from crypto service
* remove clearEncKey from crypto service
* move crypto service jsdoc to abstraction
* add org key type and new method to build a data enc key for orgs
* fix typing of bulk confirm component
* fix EncString serialization issues & various fixes
Co-authored-by: Matt Gibson <MGibson1@users.noreply.github.com>
* update account model with new keys serialization
* migrate native messaging for biometrics to use new key model
- support backwards compatibility
- update safari web extension to send user key
- add error handling
* add early exit to native messaging flow for errors
* improve error strings in crypto service
* disable disk cache for browser due to bg script/popup race conditions
* clear bio key when pin is migrated as bio is refreshed
* share disk cache to fix syncing issues between contexts
* check for ephemeral pin before process reload
* remove state no longer needed and add JSDOC
* fix linter
* add new types to tests
* remove cryptoMasterKeyB64 from account
* fix tests imports
* use master key for device approvals still
* cleanup old TODOs, add missing crypto service parameters
* fix cli crypto service calls
* share disk cache between contexts on browser
* Revert "share disk cache between contexts on browser"
This reverts commit 56a590c491.
* use user sym key for account changing unlock verification
* PM-1565 Added item key property to cipher export domain (#5580)
* PM-1565 Added item key property to cipher export domain
* enabled cipher key encryption
* Updated getCipherKeyEncryptionEnabled validation to also return true if the serverVersion matches the minVersion
* Using async/await when getting decrypted ciphers on getOrganizationDecryptedExport
* Disabling CipherKey
* add tests to crypto service
* rename 'user symmetric key' with 'user key'
* remove userId from browser crypto service
* updated EncKey to UserKey where applicable
* jsdoc deprecate account properties
* use encrypt service in crypto service
* use encrypt service in crypto service
* require key in validateUserKey
* check storage for user key if missing in memory
* change isPinLockSet to union type
* move biometric check to electron crypto service
* add secondary fallback name for bio key for safari
* migrate master key if found
* pass key to encrypt service
* rename pinLock to pinEnabled
* use org key or user key for encrypting attachments
* refactor makeShareKey to be more clear its for orgs
* rename retrieveUserKeyFromStorage
* clear deprecated keys when setting new user key
* fix cipher service test
* options is nullable while setting user key
* Reordering Service creation on cli's bw.ts to fix ConfigApiService (#5684)
* more crypto service refactors
- check for auto key when getting user key
- consolidate getUserKeyFromMemory and FromStorage methods
- move bio key references out of base crypto service
- update either pin key when setting user key instead of lock component
- group deprecated methods
- rename key legacy method
* Feature/PM-1049 - TDEFflow 3 login decryption options - PR feedback changes (#5642)
* PM-1049 - PR Feedback change - Browser - replace incorrect use of routerlink with manual attribute styling to keep anchor styling + tab focus while not having a router action race condition for the log out action to complete.
* PM-1049 - PR Feedback - State Service changes - rename get/setAcctDecryptionOptions to get/setAccountDecryptionOptions
* PM-1049 - PR Feedback changes - LoginDecryptionOptionsComp - Remove unncessary appA11yTitle directives as title / aria text would be identical to the displayed inner button text.
* DeviceType - Create sets of device types which other components can reference to avoid having to manually define groups of device types.
* PM-1049 - PR Feedback Changes - Update base-login-decryption-options component to leverage async piped observables per best practices. Updated all client templates to leverage new data streams.
* PM-1049 - BaseLoginDecryptionOptionsComp - Add validation service for generic error handling
* PM-1049 - DeviceResponse mistakenly had name as a number instead of a string
* PM-1049 - First draft of creating observable based data store service for Devices so that the base login comp can leverage it instead of calling the devices API service directly (as it will be moved into the SDK in the future).
* PM-1049 - Register new DevicesService on jslib-services module for use in components.
* PM-1049 - Add new hasDevicesOfTypes call to devices data store svc + devices API service.
* PM-1049 - BaseLoginDecryptionOptionsComp - wire up call to devicesService.hasDevicesOfTypes to replace getDevices() to avoid bringing down all trusted device information unnecessarily.
* PM-1049 - LoginDecryptionOptionsComp - Web HTML - clean up loading state so it displays spinner centered properly.
* PM-1049 - LoginDecryptionOptionsComp - Desktop HTML - Don't show login initiated title while page is loading to match other clients behavior.
* PM-1049 - Devices Services - Update naming of hasDevicesOfTypes to match new name on back end + route change to getDevicesExistenseByTypes
* PM-1049 - Device Response & View models - remove keys which are going to be deprecated on the base model
* PM-1049 - DevicesService - devicesBSubject --> devicesSubject rename per PR feedback
* PM-1049 - Devices Services - correct spelling of existence (*facepalm*)
* PM-1049 - Update comment for clarity per PR feedback
* PM-1049 - DevicesSvc - UserSymKey --> UserKey rename
* PM-1049 - BaseLoginDecryptionOptions - replace user email source - get from stateService vs tokenService.
* PM-1049 - BaseLoginDecryptionOptions - Remove uncessary check for userEmail as we will always have it here otherwise everything in the app is broken.
* PM-1049 - BaseLoginDecryptionOptions - Finish cleaning up removal of user email from showReqAdminApprovalBtn$ stream
* PM-1049 - LoginDecryptionOptionsComp - HTML revisions in web & browser to better space out buttons using tailwind or top margin to avoid need for multiple async pipes and shareReplay.
* PM-1049 - DevicesService - of course all observables should have $ suffix. Facepalm.
* PM-1049 - BaseLoginDecryptionOptionsComp - Update verbiage and style of destroy observable used for hooking into ngOnDestroy lifecycle to clean up all observables
* PM-1049 - BaseLoginDecryptionOptions - PR feedback changes - refactor user email to have an underlying bSubject stream to ensure subscription/promise execution separately from the template async pipe subscribing to the stream.
* PM-1049 - DevicesApiService - getDevicesExistenceByTypes - PR feedback - explicitly convert result to boolean instead of casting.
* PM-1049 - BaseLoginDecryptionOptionsComp - Add ShareReplay for getAccountDecryptionOptions + context per PR feedback
* PM-1049 - LoginDecryptionOptionsComp - Completely back away from template async pipe reactive approach as it caused massively increased complexity for little gain. Instead, just focus on reactively pulling asynchronously retrieved data and setting page loading state simply. This just works and is so much less overhead. + Add comments re flows of the component to be done later
* PM-1049- Revert DevicesService implementation from smart data store cache service giant mess into simple, clean data passthrough service to avoid complexity and keep moving forward. YAGNI
Co-authored-by: Andreas Coroiu <andreas@andreascoroiu.com>
* PM-1049 - DeviceCryptoService - Add decryptUserKey method (WIP)
* PM-1049 - AccountDecryptionOptions - add get helpers for checking for trusted device / key connector decryption option existence.
* PM-1049 - SSO Login Strategy - added comments in setUserKey method for where we will probably be consuming device keys and determining if the device is trusted or not (i.e., if we can get a decrypted user sym key in memory)
* PM-1049 - DeviceCryptoSvc.decryptUserKey - Update method to properly use state service device key retrieval + add TODO to figure out what to do if user has previously had a device key and has cleared their local cache (which will result in the device being untrusted now)
* PM-1049 - SSO Login Strategy - add comment re future passkey login strategy support
* PM-2759 - SSO & 2FA components updated with v0 of navigation logic to send users to LoginDecryptionOptions
* PM-1049 - Account > AccountDecryptionOptions - can't create getter helper methods for determining if user has decryption options b/c of issues w/ account deserialization. Moving past b/c I can just easily check if the given options are not undefined.
* PM-2759 - Add TODOs for deprecation of id token response resetMasterPassword logic and replacement with use of accountDecryptionOptions
---------
Co-authored-by: Andreas Coroiu <andreas@andreascoroiu.com>
* PM-2582 Fix adding attachments (#5692)
* revert sharing disk cache between contexts
* fix tests
* PM-2791 Reordered service creation (#5701)
* Turned off flag in production.json
* add better tests to crypto service
* add hack to get around duplicate instances of disk cache on browser
* prevent duplicate cache deletes in browser
* fix browser state service tests
* Feature/PM-1212 - TDE - Approve with master password flow (#5706)
* PM-1212 - StateSvc - Add getUserDeviceTrustChoice && setUserDeviceTrustChoice to persist user's choice in local storage in case of refresh on login approval screens (ex: lock)
* PM-1212 - DeviceCryptoSvc - Add getUserDeviceTrustChoice && setUserDeviceTrustChoice as state service is lower level service for caching
* PM-1212 - LoginDecryptionOptionsComp - Save result of rememberEmail checkbox into local storage via deviceCryptoService.setUserDeviceTrustChoice
* PM-1212 - Lock component - after user key is set, check if user chose to establish trust, and if they did, then establish trust and reset choice.
* PM-1212 - Update naming of methods per discussion with Jake + add comment explaining intended single use retrieval and need for resetting the value.
* DeviceCryptoService - Refactor - decryptUserKey --> decryptUserKeyWithDeviceKey to match crypto service refactor naming convention
* PM-1212 - Refactor State Service per PR feedback to store trustDeviceChoiceForDecryption on Account.settings b/c the temp setting is scoped to a user.
* PM-2759 - SSO & 2FA Navigation to TDE Comp - Needs more work - Found scenarios on web with 2FA in which the expected navigation doesn't work. Adding TODO to assist in fixing
* (1) Add Trust to DeviceCryptoService name
(2) Move DeviceTrustCryptoService under auth folder
* PM-1212 - Add tests for new getUserTrustDeviceChoiceForDecryption and setUserTrustDeviceChoiceForDecryption methods + TODOs for future tests.
* PM-1212- Renaming / moving DeviceTrustCryptoService broke all the things - fixed all the client builds.
* PM-1212- Copy doc comment to abstraction per PR feedback
* PM-1212 - BaseLoginDecryptionOptions comp - remove unncessary cast to form control as apparently reactive forms now properly derives types.
* [PM-1203] Replace MP confirmation with verification code (#5656)
* [PM-1203] feat: ask for OTP if user does not have MP
* [PM-1203] feat: add backwards compatibility for accounts/servers without decryption options
* [PM-1203] feat: move hasMasterPassword to user-verification.service
* [PM-1203] fix: remove duplicate implementation from crypto service
* [PM-1203] fix: cli build
* Tweak device trust crypto service implementation to match mobile late… (#5744)
* Tweak device trust crypto service implementation to match mobile latest which results in more single responsibility methods
* Update tests to match device trust crypto service implementation changes
* update comment about state service
* update pinLockType states and add jsdocs
* add missed pinLockType changes
* [PM-1033] Org invite user creation flow 1 (#5611)
* [PM-1033] feat: basic redirection to login initiated
* [PM-1033] feat: add ui for TDE enrollment
* [PM-1033] feat: implement auto-enroll
* [PM-1033] chore: add todo
* [PM-1033] feat: add support in browser
* [PM-1033] feat: add support for desktop
* [PM-1033] feat: improve key check hack to allow regular accounts
* [PM-1033] feat: init asymmetric account keys
* [PM-1033] chore: temporary fix bug from merge
* [PM-1033] feat: properly check if user can go ahead an auto-enroll
* [PM-1033] feat: simplify approval required
* [PM-1033] feat: rewrite using discrete states
* [PM-1033] fix: clean-up and fix merge artifacts
* [PM-1033] chore: clean up empty ng-container
* [PM-1033] fix: new user identification logic
* [PM-1033] feat: optimize data fetching
* [PM-1033] feat: split user creating and reset enrollment
* [PM-1033] fix: add missing loading false statement
* [PM-1033] fix: navigation logic in sso component
* [PM-1033] fix: add missing query param
* [PM-1033] chore: rename to `ExistingUserUntrustedDevice`
* PM-1033 - fix component templates to reference `ExistingUserUntrustedDevice` so clients can build
---------
Co-authored-by: Jared Snider <jsnider@bitwarden.com>
* remove extra partial key
* set master key on lock component
* rename key hash to password hash on crypto service
* fix cli
* rename enc user key setter in crypto service
* Adds Events & Human Readable Messages (#5746)
* [PM-1202] Hide the Master Password tab on Settings / Security (#5649)
* [PM-1203] feat: ask for OTP if user does not have MP
* [PM-1203] feat: get master password status from decryption options
* [PM-1203] feat: add backwards compatibility for accounts/servers without decryption options
* [PM-1203] feat: move hasMasterPassword to user-verification.service
* fix merge issues
* Change getUserTrustDeviceChoiceForDecryption / setUserTrustDeviceChoiceForDecryption to getShouldTrustDevice / setShouldTrustDevice (#5795)
* Auth/[PM-1260] - Existing User - Login with Trusted Device (Flow 2) (#5775)
* PM-1378 - Refactor - StateSvc.getDeviceKey() must actually convert JSON obj into instance of SymmetricCryptoKey
* TODO: BaseLoginDecryptionOptionsComponent - verify new user check doesn't improperly pick up key connector users
* PM-1260 - Add new encrypted keys to TrustedDeviceUserDecryptionOptionResponse
* PM-1260 - DeviceTrustCryptoSvc - decryptUserKeyWithDeviceKey: (1) update method to optionally accept deviceKey (2) Return null user key when no device key exists (3) decryption of user key now works in the happy path
* PM-1260 - LoginStrategy - SaveAcctInfo - Must persist device key on new account entity created from IdTokenResponse for TDE to work
* PM-1260 - SSO Login Strategy - setUserKey refactor - (1) Refactor existing logic into trySetUserKeyForKeyConnector + setUserKeyMasterKey call and (2) new trySetUserKeyWithDeviceKey method for TDE
* PM-1260 - Refactor DeviceTrustCryptoService.decryptUserKeyWithDeviceKey(...) - Add try catch around decryption attempts which removes device key (and trust) on decryption failure + warn.
* PM-1260 - Account - Add deviceKey to fromJSON
* TODO: add device key tests to account keys
* TODO: figure out state service issues with getDeviceKey or if they are an issue w/ the account deserialization as a whole
* PM-1260 - Add test suite for decryptUserKeyWithDeviceKey
* PM-1260 - Add interfaces for server responses for UserDecryptionOptions to make testing easier without having to use the dreaded any type.
* PM-1260 - SSOLoginStrategy - SetUserKey - Add check looking for key connector url on user decryption options + comment about future deprecation of tokenResponse.keyConnectorUrl
* PM-1260 - SSO Login Strategy Spec file - Add test suite for TDE set user key logic
* PM-1260 - BaseLoginStrategy - add test to verify device key persists on login
* PM-1260 - StateService - verified that settings persist properly post SSO and it's just device keys we must manually instantiate into SymmetricCryptoKeys
* PM-1260 - Remove comment about being unable to feature flag auth service / login strategy code due to circ deps as we don't need to worry about it b/c of the way we've written the new logic to be additive.
* PM-1260 - DevicesApiServiceImplementation - Update constructor to properly use abstraction for API service
* PM-1260 - Browser - AuthService - (1) Add new, required service factories for auth svc and (2) Update auth svc creation in main.background with new deps
* PM-1260 - CLI - Update AuthSvc deps
* PM-1260 - Address PR feedback to add clarity / match conventions
* PM-1260 - Resolving more minor PR feedback
* PM-1260 - DeviceTrustCryptoService - remove debug warn
* PM-1378 - DeviceTrustCryptoSvc - TrustDevice - Fix bug where we only partially encrypted the user key with the device public key b/c I incorrectly passed userKey.encKey (32 bytes) instead of userKey.key (64 bytes) to the rsaEncrypt function which lead to an encryption type mismatch when decrypting the user's private key with the 32 byte decrypted user key obtained after TDE login. (Updated happy path test to prevent this from happening again)
* PM-1260 - AccountKeys tests - add tests for deviceKey persistence and deserialization
* PM-1260 - DeviceTrustCryptoSvc Test - tweak verbiage per feedback
* PM-1260 - DeviceTrustCryptoSvc - Test verbiage tweak part 2
* Update apps/browser/src/background/service-factories/devices-api-service.factory.ts
per PR feedback
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
---------
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* Defect - LockComp - After setting user key, must AWAIT retrieval of user's previous choice to have trusted the device or not. (#5804)
* [PM-2928] [PM-2929] [PM-2930] Fixes for: [PM-1203] Replace MP confirmation with verification code (#5798)
* [PM-2928] feat: hide change email if user doen't have MP
* [PM-2929] feat: hide KDF settings if user doesn't have MP
* [PM-2930] feat: remove MP copy
* Removed self-hosted check from TDE SSO config. (#5837)
* [PM-2998] Move Approving Device Check (#5822)
* Switch to retrieving approving device from token response
- Remove exist-by-types API call
- Define `HasApprovingDevices` on TDE options
* Update Naming
* Update Test
* Update Missing Names
* [PM-2908] feat: show account created toast (#5810)
* fix bug where we weren't passing MP on Restart to migrate method in lock
* fix: buffer null error (#5856)
* Auth/[pm-2759] - TDE - SSO and 2FA routing logic (#5829)
* PM-2759 - SsoComp - (1) Temp remove all TDE routing logic (2) Refactor existing navigation logic via new component utility function navigateViaCallbackOrRoute
* PM-2759 - SSO Component - Create test suite for logIn logic
* PM-2759 - SsoComp Tests - add disclaimer regarding testing private methods and props
* PM-1259 - SSO Comp - Refactor LogIn method to use functions for each navigation case for improved readability
* PM-1259 - SSO Comp Tests - Add tests for error case during login + test for new handleLoginError logic
* PM-2759 - SsoComp - Deprecate resetMasterPassword and replace with AccountDecryptionOptions logic + update tests
* PM-2759 - SsoComp + tests - Add trusted device encryption first draft handling which has login success and force password reset handling
* PM-2759 - Minor SsoComp comment and method name tweaks
* PM-2759 - BaseTwoFactorComp - (1) Comment out TDE stuff for now (2) Add test suite (3) Replace global window in base comp constructor with angular injection token for window which follows best practices and allows for mocking so the comp can be unit tested
* PM-2759 - Update child 2FA components to use angular injection token for window like base comp
* PM-2759 - TwoFactorComp - Finish testing all logic in doSubmit
* PM-2759 - TwoFactorComponent - Refactor DoSubmit method logic into multiple simple functions to make logic easier to follow
* PM-2759 - Add newtrustedDeviceOption.hasManageResetPasswordPermission property to match server changes
* PM-2759 - Flag AuthResult.resetMasterPassword property as deprecated
* PM-2759 - SSO comp - TDE routing logic - User without MP and ResetPassword permission must set a MP
* PM-2759 - Update Sso Comp tests to reflect additionally added TDE > MP set required logic (when user has no MP but they can reset other user passwords)
* PM-2759 - SsoComp - Add comment explaining the happy paths better for TDE success navigation
* PM-2759 - SsoComp - Refactor isTrustedDeviceEncEnabled logic into own method
* PM-2759 - SsoComp - As the 2FA comp passes the org id through to each route, going to standardize on doing so across the board for now to avoid any tricky scenarios down the line where it is needed and it's not present
* PM-2759 - SsoComp - Finish renaming orgIdFromState to orgIdentifier
* PM-2759 - SsoComp - update tests for forcePasswordReset flows now passing orgIdentifier as query param
* PM-2759 - SsoComp Tests - Export mockAcctDecryptionOpts permutations so we can share them across SsoComp and TwoFactorComp tests
* PM-2759 - Refactor 2FA comp post login redirect logic to match SSO component + add TDE logic
* PM-2759 - SsoComp - Refactor tests a bit for improved re-use
* PM-2759 - Sso Comp tests - can't export consts from a spec file or the other spec files that import them will re-execute the whole test suite as a nested test suite. TIL.
* PM-2759 - TwoFactorComp tests - All existing navigation scenarios + new TDE scenarios should now be tested.
* PM-2759 - Web - 2FA comp - Fix build error b/c of renamed base comp prop (identifier --> orgIdentifier)
* PM-2759 - Fix SsoLogin strategy tests b/c they were broken w/ the addition of the HasManageResetPasswordPermission prop to the TrustedDeviceOption interface
* PM-2759 - Web TwoFactorComp - goAfterLogIn method must be an arrow function to inherit the parent base component scope so that important things like angular services can be defined. Web 2FA flow does not work without this being an arrow func.
* PM-2759 - Fix typo
* PM-2759 - SsoComp and TwoFactorComp tests - move service and other mocks into the top level before each to better ensure no crossover between test states per PR feedback
* PM-2759 - SsoComp - add clarity by refactoring unclear comment
* PM-2759 - SsoComp - Per excellent PR feedback, refactor if else statements to guard statements for better readability / design
* PM-2759 - TwoFactorComp - Replace ifs with guard statements
* PM-2759 - TwoFactorComp - add clarity to comment per PR feedback
* PM-2759 - Replace use of jest.Mocked with MockProxy per PR feedback
* PM-2759 - Use unknown over any per PR feedback
* Bypass Master Password Reprompt if a user does not have a MP set (#5600)
* Add a check for a master password in PasswordRepromptService.enabled()
* Add tests for enabled()
* Update state service method call
* Use UserVerificationService to determine if a user has a master password
* rename password hash to master key hash
* fix cli build from key hash renaming
* [PM-1339] Allow Rotating Device Keys (#5806)
* Merge remote-tracking branch 'origin/feature/trusted-device-encryption' into Auth/pm-1339/rotate-device-keys
* Implement Rotation of Current Device Keys
- Detects if you are on a trusted device
- Will rotate your keys of only this device
- Allows you to still log in through SSO and decrypt your vault because the device is still trusted
* Address PR Feedback
* Move Files to Auth Ownership
* fix: getOrgKeys returning null
* [PM-3143] Trusted device encryption: Refactor reset enroll service (#5869)
* create new reset enrollment service
* refactor: login decryption options according to TODO
* feat: add tests
* PM-3143 - Add override to overriden methods
---------
Co-authored-by: Jared Snider <jsnider@bitwarden.com>
* generate a master key from master password if needed (#5870)
* [PM-3120] fix: device key not being saved properly (#5882)
* pm-2582 Moved code to cipher service (#5818)
* Auth/pm 1050/pm 1051/remaining tde approval flows (#5864)
* fix: remove `Unauth guard` from `/login-with-device`
* Turned encryption on (#5908)
* [PM-3101] Fix autofill items not working for users without a master password (#5885)
* Add service factories for user verification services
* Update autofill service to check for existence of master password for autofill
* Update the context menu to check for existence of master password for autofill
* context menu test fixes
* [PM-3210] fix: use back navigation (#5907)
* Removed buttons (#5935)
* PM-2759 - Fix broken backwards compatibility for authResult.resetMast… (#5940)
* PM-2759 - Fix broken backwards compatibility for authResult.resetMasterPassword
* PM-2759 - Update TODO with specific tech debt task + target release date
* TDE - State Svc - setDeviceKey should support setting null for future support of clearing device key. (#5942)
* Check if a user has a mp before showing kdf warning (#5929)
* [PM-1200] Unlock settings changes for accounts without master password - clients (#5894)
* [PM-1200] chore: add comment for jake
* [PM-1200] chore: rename to `vault-timeout`
* [PM-1200] feat: initial version of `getAvailableVaultTimeoutActions`
* [PM-1200] feat: implement `getAvailableVaultTimeoutActions`
* [PM-1200] feat: change helper text if only logout is available
* [PM-1200] feat: only show available timeout actions
* [PM-1200] fix: add new service factories and dependencies
* [PM-1200] fix: order of dependencies
`UserVerificationService` is needed by `VaultTimeoutSettingsService`
* [PM-1200] feat: add helper text if no lock method added
* [PM-1200] refactor: simplify prev/new values when changing timeout and action
* [PM-1200] feat: fetch timeout action from new observable
* [PM-1200] refactor: make `getAvailableVaultTimeoutActions` private
* [PM-1200] feat: add test cases for `vaultTimeoutAction$`
* [PM-1200] feat: implement new timeout action logic
* [PM-1200] feat: add dynamic lock options to browser
* [PM-1200] feat: enable/disable action select
* [PM-1200] feat: add support for biometrics
* [PM-1200] feat: add helper text and disable unavailable options
* [PM-1200] feat: update action on unlock method changes
* [PM-1200] feat: update browser to use async pipe
* [PM-1200] fix: element not updating
* [PM-1200] feat: hide masterPassOnRestart pin option
* [PM-1200] feat: hide change master password from browser settins
* [PM-1200] feat: hide change master password from app menu
* [PM-1200] feat: logout if lock is not supported
* [PM-1200] feat: auto logout from lock screen if unlocking is not supported
* [PM-1200] feat: remove lock button from web menus
* Revert "[PM-1200] fix: element not updating"
This reverts commit b27f425f48570d0d5dbc9dedb9797023fef64d8b.
* Revert "[PM-1200] feat: update browser to use async pipe"
This reverts commit 766c15bc3dbadcf7dcef3053b148e7874f8939ce.
* [PM-1200] chore: add comment regarding detectorRef
* [PM-1200] feat: remove lock now button from browser settings
* [PM-1200] feat: add `userId` to unlock settings related methods
* [PM-1200] feat: remove non-lockable accounts from menu
* [PM-1200] fix: cli not building
---------
Co-authored-by: Todd Martin <tmartin@bitwarden.com>
Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>
* [PM-3215][PM-3289] Create MasterKey from Password If Needed (#5931)
* Create MasterKey from Password
- Check if the MasterKey is stored or not
- Create it if it's not
* Add getOrDeriveKey Helper
* Use Helper In More Places
* Changed settings menu to be enabled whenever the account is not locked. (#5965)
* [PM-3169] Login decryption options in extension popup (#5909)
* [PM-3169] refactor: lock guard and add new redirect guard
* [PM-3169] feat: implement fully rewritten routing
* [PM-3169] feat: close SSO window
* [PM-3169] feat: store sso org identifier in state
* [PM-3169] fix: tests
* [PM-3169] feat: get rid of unconventional patch method
* PM-3169 - SSO & 2FA Comps - Update naming of new callback to match existing pattern + add tests for callback logic execution.
* PM-3169 - Update LockGuard to have a special exception for allowing the TDE Login with MP flow
* PM-3169 - Per discussion w/ Jake and Justin, rename login-initiated guard to be tde decryption required guard (more named for functionality vs specific route)
* PM-3169 - Add some additional context to new redirect guard scenario
* PM-3169 - Per PR feedback, replace all callback types with Promise<void> as the return values are not being used.
* PM-3169 - StateSvc - Per PR feedback, update setUserSsoOrganizationIdentifier signature to explicitly use null instead of partial<string> which doesn't do anything
* PM-3169 - Replace onSuccessfulLogin type to compile
* PM-3169 - Add clarification comment for why we are not using a query param for persisting the org identifier
* PM-3169 - Per discussion with Justin, only use memory for SsoOrgId as we don't need to persist it beyond that; tested and it worked on all 3 clients for new user TDE creation
* PM-3169 - Add missing ssoIdentifierRequired translation to desktop and browser
* PM-3169 - After discussing with Justin again, we realized that memory doesn't work on desktop if user refreshes app or closes and re-opens it so must use disk.
* PM-3169 - Per PR feedback, remove hasEverHadUserKey logic as we can just leverage existing getUserKey method to check if we have a user key or not; tested all guards in browser and web with no issues
* PM-3169 - Per design discussion with Danielle, move account created toast after successful account creation vs on load of page.
---------
Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>
Co-authored-by: Jared Snider <jsnider@bitwarden.com>
* [PM-3314] Fixed missing MP prompt on lock component (#5966)
* Updated lock component to handle no master password.
* Added a comment.
* Add Missing Slash (#5967)
* Fix AdminAuthRequest Serialization on Desktop (#5970)
- toJSON isn't being called by ElectronStorageService
- Force it's conversion to JSON earlier so it happens for all storage methods
* Fix issue where we were incorrectly calling setRememberEmailValues in the AdminAuthRequest state - no need to do this as the email is already saved to state. By calling this method, we would actually overwrite the already saved email with null as the user's choice to remember email wasn't persisted through SSO on the login service. (#5972)
* PM-3329 - Restore everHadUserKey logic from PM-3169 which I incorrectly removed in order to fix routing logic so that user can lock and land on the lock screen properly (#5979)
* PM-3210 - TDE - LoginWithDevice routing fix - Mirror PR #5950 in just simply providing a back action on click which works for all app generated scenarios (#5982)
* PM-3332 - TDE - SsoLoginStrategy - For existing admin auth reqs, must… (#5980)
* PM-3332 - TDE - SsoLoginStrategy - For existing admin auth reqs, must manually handle 404 error case to prevent app from hanging and clear the local state if the admin auth req in the DB has been purged; i.e., it should fail silently.
* Add TODO for SSO Login Strategy tests
* PM-3331 - TDE - Firefox - Browser extension - fix access denied error… (#5984)
* PM-3331 - TDE - Firefox - Browser extension - fix access denied error on popup load which was caused by the canAccessFeature guard failing to lookup the TDE feature flag as the server config was returning null even after a successful server call as only returned the value if the user was unauthenticated for some reason
* PM-3331 - After discussion with Andre, further refactor ConfigService logic to always return the latest information from the server so that requests for feature flag data will always get the most up to date information.
* PM-3345 - TDE - Desktop - Biometrics setting submenu tweak - do not s… (#5988)
* PM-3345 - TDE - Desktop - Biometrics setting submenu tweak - do not show require MP or PIN entry on restart if user doesn't have at least one of those options b/c otherwise user can get into a bad state where they cannot unlock
* PM-3345 - TDE - Desktop - Settings comp - if user turns off PIN and Biometric is on + require PIN on restart is enabled then must turn that setting off to prevent bad user state
* PM-3345 - Final tweak to logic
* [PM-2852] Final merge from Key Migration branch to TDE Feature Branch (#5977)
* [PM-3121] Added new copy with exclamation mark
* [PM 3219] Fix key migration locking up the Desktop app (#5990)
* Only check to migrate key on VaultTimeout startup
* Remove desktop specific check
* PM-3332 - LoginWithDevice - Add error handling logic around admin auth request retrieval similar to sso login strategy to prevent error state and allow re-creation of an admin auth request if it has been purged from the server for whatever reason. (#5991)
* PM-3355 - TDE - Browser JIT Account Creation - Browser create user logic still had logic for simply closing the extension tab but as we no longer open the login decryption options in a tab we needed to update the logic here to navigate the user directly onto the vault. (#5993)
* Add distinctUntilChanged to fix multiple value changes for biometrics firing (#5999)
* Add optional chaining to master key (#6007)
* PM-3369 - TDE - Persist user's choice to trust device to state when user ma… (#6000)
* PM-3369 - Persist user's choice to trust device to state when user makes choice + persist previous choices out of state
* PM-3369 - Must set trust device in state on load if it's never been set before
* PM-3369 - Refactor BaseLoginDecOptions to properly set trust device choice in state on load
* Update libs/angular/src/auth/components/base-login-decryption-options.component.ts
Co-authored-by: Jake Fink <jfink@bitwarden.com>
---------
Co-authored-by: Jake Fink <jfink@bitwarden.com>
* Updated email change component to getOrDeriveMasterKey (#6009)
* [PM-3330] Force Update to Lockable Accounts on PIN/Biometric Update (#6006)
* Add Listener For Events that Need To Redraw the Menu
* Send redrawMenu Message When Pin/Biometrics Updated
* DeviceTrustCryptoService - don't worry about checking if a device should establish trust or not if the user doesn't have trusted device encryption on (#6010)
* Auth / pm 3351 / TDE Login - Browser & Desktop vault sync issue fix (#6002)
* PM-3351 - TDE Login on desktop and browser via SSO comp with no 2FA should trigger sync like standard onSuccessfulLogin process used to so user lands on vault with data.
* PM-3351 - 2FA Comp - Refactor onSuccessfulLogin logic to only execute in the success path just like the SSO component + adding specific onSuccessfulLoginTde flow just like SSO comp. + removed unnecessary calls to loginService.clearValues(). Added browser & desktop definitions for onSuccessfulLoginTde which is just a fullSync kick off.
* TODO
* PM-3351 - remove await to restore code back to previous state without hang.
* PM-3351 - 2FA Comp - Don't await onSuccessfulLoginTde b/c it causes a hang
* PM-3351 - remove sso comp incorrect todo
* PM-3351 - SsoComp - don't await onSuccessfulLoginTde for browsers sake
* PM-3351 - SsoComp - remove awaits from onSuccessfulLoginTde and onSuccessfulLogin to avoid any hangs on desktop and browser
* PM-3351 - Convert onSuccessfulLoginTde to promise<void> as its return is not used + refactor all to be consistent and clearly communciate that the sync won't be awaited.
* PM-3351 - Convert onSuccessfulLogin to promise<void> and update all methods accordingly to more clearly indicate that the syncs and any other logic won't be awaited.
* [PM-3356] Fallback to OTP When MasterPassword Hasn't Been Used (#6017)
* Fallback to OTP When MasterPassword Hasn't Been Used
* Update Test and Rename Method
* Revert "DeviceTrustCryptoService - don't worry about checking if a device should establish trust or not if the user doesn't have trusted device encryption on (#6010)" (#6020)
This reverts commit 6ec22f9570.
* PM-3390 - TDE - Redraw desktop after user creation to update isLocked checks and get menu to be enabled properly (#6018)
* [PM-3383] Hide Change Password menu option for user with no MP (#6022)
* Hide Change Master Password menu item on desktop when a user doesn't have a master password.
* Renamed variable for consistency.
* Updated to base logic on account.
* Fixed menubar
* Resolve merge errors in crypto service spec
* Fixed autofill to use new method on userVerificationService (#6029)
* conflict resolution
* missing file
* PM-3456 - TDE Admin Auth Req Flow - FF dead object issue - The foreground popup must retrieve the long lived background services for the new TDE services (the AuthRequestCryptoService service fixes this issue, but the DeviceTrustCryptoService should have been added to services.module as well) (#6037)
* skip auto key check when using biometrics on browser (#6041)
* Added comments for backward compatibility removal. (#6039)
* Updated warning message. (#6059)
* Tde pr feedback (#6051)
* move pin migration to the crypto service
* refactor config service logic
* refactor lock component load logic
* rename key connector methods
* add date to backwards compat todo
* update backwards compat todo
* don't specify defaults in redirectGuard
* nit
* add null & undefined check for userid before using the account
* fix ui tests
* add todo for tech debt
* add todo comment
* Fix storybook per PR feedback
* Desktop & Browser - lock comp - add optional chaining check for focusable input - user can just have biometric and not have a MP or a PIN so must support that.
* Main.background.ts - remove duplicate instantiations of the userVerificationApiService and userVerificationService which were added in two separate PRs
* Per PR feedback - (1) Browser app routing module - fix incorrect import for redirect guard (2) Created index.ts file for auth guards to simplify imports and updated imports
* Per PR feedback, (1) Update jslib-services.module to provide actual instance of VaultTimeoutService (2) Update init service to use concrete VaultTimeoutService vs abstraction.
Co-authored-by: Matt Gibson <git@mgibson.dev>
* Per PR feedback - update services module AuthRequestCryptoService and DeviceTrustCryptoService to use shorthand format.
* Per PR feedback, add devicesService to main background and update services module to ensure the popup leverages the background devicesService
---------
Co-authored-by: Jared Snider <jsnider@bitwarden.com>
Co-authored-by: Matt Gibson <git@mgibson.dev>
* Updated message keys for CrowdIn to pick them up. (#6066)
* TDE PR Feedback resolutions round 2 (#6068)
* Per PR feedback - main.background.ts - move userVerificationService and userVerificationApiService to correct location
* Per PR feedback - JS lib services + vault timeout service updates - (1) Correctly type callbacks based on injection tokens (2) Update vault timeout service to have proper types based on injection tokens
* Per PR Feedback - update web init service to inject actual VaultTimeoutService vs abstraction similar to what we did for desktop here: 55a797d4ff
* Per more feedback - revert incorrect changes to VaultTimeoutService based on existing injection token types for LOGOUT_CALLBACK and LOCKED_CALLBACK.. and instead update the injection token types themselves to match how they are being used.
* Per PR feedback - in browser main.background.ts, inject concrete VaultTimeoutService instead of abstraction so we don't have to cast it anymore (matching web & desktop)
* Conflict resolution
* PM-2669 Added missing changes from conflict resolution
* Turn cipher encryption on for testing purposes
* Bumped up minimum version
* Turn off cipher key encryption
* Converted to jest-mock-extended and removed dependency
* Remove key from cipher view
* Added comment to Cipher for future refactoring (#6175)
* Remove ConfigApiServiceAbstraction from popup services (#6174)
* Replaced null orgId. (#6208)
* Added reference to new aesGenerateKey function. (#6222)
* Updated server version and feature flag for QA smoke tests.
* [PM-2814] Add ConfigService to CipherService (#6239)
* Updated CipherService to use ConfigService
Updated version check.
* Added missing DI for CLI.
* Updated parameter name for consistency.
* Addressed use of options pattern in config-service.factory.ts.
* Added CLI initialization. (#6266)
* Updated checkServerMeetsVersionRequirement to use observable (#6270)
* [PM-2814] Handle key rotation missing key (#6267)
* Fixed issue with key rotation
* Updates to CipherService to handle not having key on the model.
* More refactoring.
* Updated abstraction to remove private method.
* Fixed test.
* Updated test to reflect the fact that we set key to null.
* Resolved merge conflicte with logService added in master.
* Updated Mv3 factory include log service from merge in ConfigService initialization.
* Fixed another merge conflict with ConfigService to add logService dependency.
* Disable configService timer for cli (#6319)
The rxjs timer() function keeps the node process alive and stops it from exiting.
CLI should not run long enough to actually use the timer, so just remove it.
* [PM-3978] Handle sharing with org with cipher key encryption (#6370)
* Added explicit parameters to encrypt to handle org sharing.
* Updated add-edit to handle new parameter to encrypt
* Updated minimum server version for QA testing.
* Updated minimum version to `2023.8.0` and turned off cipher encryption for QA.
* Updated minimum server version in preparation for release.
* [PM-2669] PR review changes (#6415)
* Addressed PR feedback.
* Added comments and renamed parameters for clarity.
* Updated vault export to keep immediate invocation and reformat for clarity.
Co-authored-by: aj-rosado <109146700+aj-rosado@users.noreply.github.com>
* Updated comment.
* Removed async that was left on saveCipherAttachment accidentally.
---------
Co-authored-by: aj-rosado <109146700+aj-rosado@users.noreply.github.com>
---------
Co-authored-by: Jared Snider <jsnider@bitwarden.com>
Co-authored-by: gbubemismith <gsmithwalter@gmail.com>
Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>
Co-authored-by: Jacob Fink <jfink@bitwarden.com>
Co-authored-by: Matt Gibson <MGibson1@users.noreply.github.com>
Co-authored-by: Andreas Coroiu <andreas.coroiu@gmail.com>
Co-authored-by: Carlos Gonçalves <cgoncalves@bitwarden.com>
Co-authored-by: aj-rosado <109146700+aj-rosado@users.noreply.github.com>
Co-authored-by: Andreas Coroiu <andreas@andreascoroiu.com>
Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Co-authored-by: André Bispo <abispo@bitwarden.com>
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
Co-authored-by: Matt Gibson <git@mgibson.dev>
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
The .1pux-format is technically just a ziup-file that contain a file named `export.data`which is a json file.
These changes add support to upload either a 1pux or the export.data file directly.
The thought to change this came through the recent addtion of the ProtonPass importer.
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* feat(cli): add minNumber option and pass to generation service
* feat(cli): add minSpecial option and pass to generation service
* feat(cli): add ambiguous option and pass to generation service
* refactor: extract utils to convert number and string options
* feat(ts): add types to utils and options
* feat: validate result of parsed value in convertNumberOption util
* WIP: safer state migrations
Co-authored-by: Justin Baur <justindbaur@users.noreply.github.com>
* Add min version check and remove old migrations
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
* Add rollback and version checking
* Add state version move migration
* Expand tests and improve typing for Migrations
* Remove StateMigration Service
* Rewrite version 5 and 6 migrations
* Add all but initial migration to supported migrations
* Handle stateVersion location in migrator update versions
* Move to unique migrations directory
* Disallow imports outside of state-migrations
* Lint and test fixes
* Do not run migrations if we cannot determine state
* Fix desktop background StateService build
* Document Migration builder class
* Add debug logging to migrations
* Comment on migrator overrides
* Use specific property names
* `npm run prettier` 🤖
* Insert new migration
* Set stateVersion when creating new globals object
* PR comments
* Fix migrate imports
* Move migration building into `migrate` function
* Export current version from migration definitions
* Move file version concerns to migrator
* Update migrate spec to reflect new version requirements
* Fix import paths
* Prefer unique state data
* Remove unnecessary async
* Prefer to not use `any`
---------
Co-authored-by: Justin Baur <justindbaur@users.noreply.github.com>
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
* PM-1049 - Create first display draft of login-decryption-options base and web components (no data loading or user actions wired up yet; WIP)
* PM-1049 - Update DeviceResponse to match latest properties on backend
* PM-1049 - Add getDevices call to retrieve all user devices to API service
* PM-1049 - WIP on figuring out login decryption options component requirements
* PM-1049 - Add empty login decryption options to desktop
* PM-1049 - Desktop - Update "Log in initiated" translation to be "Login Initiated" per figma and product request
* PM-1049 - Desktop - login decryption options component html done
* PM-1049 - Move login-decryption-options in web into own folder
* PM-1049 - Browser - created html for login-decryption-options component
* PM-1049 - Move newly created getDevices() method out of api.service into proper place in new devices-api.service.
* PM-1049 -Comment cleanup and TODO added
* PM-1049 - Comment cleanup and dependency cleanup across all login-decryption-options comps
* PM-1049 - WIP of building out needed response and regular models for saving new UserDecryptionOptions on the Account in state.
* PM-1049 - Update all User Decryption Options response and state models in light of the back end changes from a list to an object. Web building now with decryption options stored on state under the account successfully. Must now build out state service methods for retrieving / setting account decryption options for use elsewhere.
* PM-1049 - State Service - setup setters / getters for UserDecryptionOptions off the account
* PM-1049 - StateService - replace User with Acct for decryption options
* PM-1049 - Create domain models vs using response models as response models have a response property w/ the full response nested underneath which we don't need to persist for the user decryption options stored on the account.
* PM-1049 - AcctDecryptionOptions now persist across page refreshes of the login-initiated page to act similarly to refreshes on the lock screen. Accomplished via persisting AcctDecryptionOptions in local storage -- still cleared on logout.
* PM-1049 - IdTokenResponse - only userDecryptionOptions if they exist on the response from the server; I saw a few instances where it did not. Wasn't able to replicate consistently, but I put this check here to be safe.
* PM-1049 - Login Initiated route can only be accessed if user is AuthN w/ locked vault + TDE feature flag is on.
* PM-1049 - LoginDecryptionOptions - (1) Wire up loading logic (2) Retrieve User Acct Decryption options to determine whether or not to show request admin approval btn and approve w/ MP (3) Write up future logic for requestAdminApproval (4) approveWithMasterPassword takes you to the lock screen to login.
* PM-1049 - Apply same guards as in web to login-decryption-options in desktop & browser.
* PM-1049 - (1) Updated dependencies in parent BaseLoginDecryptionOptionsComponent class + child components (2) Retrieve userEmail b/c needed for displaying which email the user is logging in with (3) Add log out functionality (4) Add comments regarding future implementation details for each login approval flow.
* PM-1049 - Web/Browser/Desktop LoginDecryptionOptions - (1) Wire up approval buttons (2) Add conditional margins (3) Loading spinner added (4) Display userEmail + "not you" logout link
* PM-1049 - Add TODOs for future changes needed as part of the Login Approval flows for TDE
* PM-1049 - TODO: replace base component with business service
* add new storage to replace MasterKey with UserSymKey
* add storage for master key encrypted user symmetric key
* Begin refactor of crypto service to support new key structure
* remove provided key from getKeyForUserEncryption
* add decryption with MasterKey method to crypto service
* update makeKeyPair on crypto service to be generic
* add type to parameter of setUserKey in abstraction of crypto service
* add setUserSymKeyMasterKey so we can set the encrypted user sym key from server
* update cli with new crypto service methods
- decrypt user sym key and set when unlocking
* separate the user key in memory from user keys in storage
* add new memory concept to crypto service calls in cli
* update auth service to use new crypto service
* update register component in lib to use new crypto service
* update register component again with more crypto service
* update sync service to use new crypto service methods
* update send service to use new crypto service methods
* update folder service to use new crypto service methods
* update cipher service to use new crypto service
* update password generation service to use new crypto service
* update vault timeout service with new crypto service
* update collection service to use new crypto service
* update emergency access components to use new crypto service methods
* migrate login strategies to new key model
- decrypt and set user symmetric key if Master Key is available
- rename keys where applicable
- update unit tests
* migrate pin to use user's symmetric key instead of master key
- set up new state
- migrate on lock component
- use new crypto service methods
* update pin key when the user symmetric key is set
- always set the protected pin so we can recreate pin key from user symmetric key
- stop using EncryptionPair in account
- use EncString for both pin key storage
- update migration from old strategy on lock component
* set user symmetric key on lock component
- add missed key suffix types to crypto service methods
* migrate auto key
- add helper to internal crypto service method to migrate
* remove additional keys in state service clean
* clean up the old pin keys in more flows
- in the case that the app is updated while logged in and the user changes their pin, this will clear the old pin keys
* finish migrate auto key if needed
- migrate whenever retrieved from storage
- add back the user symmetric key toggle
* migrate biometrics key
- migrate only on retrieval
* fix crypto calls for key connector and vault timeout settings
* update change password components with new crypto service
* update assortment of leftover old crypto service calls
* update device-crypto service with new crypto service
* remove old EncKey methods from crypto service
* remove clearEncKey from crypto service
* move crypto service jsdoc to abstraction
* add org key type and new method to build a data enc key for orgs
* fix typing of bulk confirm component
* fix EncString serialization issues & various fixes
Co-authored-by: Matt Gibson <MGibson1@users.noreply.github.com>
* update account model with new keys serialization
* migrate native messaging for biometrics to use new key model
- support backwards compatibility
- update safari web extension to send user key
- add error handling
* add early exit to native messaging flow for errors
* improve error strings in crypto service
* disable disk cache for browser due to bg script/popup race conditions
* clear bio key when pin is migrated as bio is refreshed
* share disk cache to fix syncing issues between contexts
* check for ephemeral pin before process reload
* remove state no longer needed and add JSDOC
* fix linter
* add new types to tests
* remove cryptoMasterKeyB64 from account
* fix tests imports
* use master key for device approvals still
* cleanup old TODOs, add missing crypto service parameters
* fix cli crypto service calls
* share disk cache between contexts on browser
* Revert "share disk cache between contexts on browser"
This reverts commit 56a590c491.
* use user sym key for account changing unlock verification
* add tests to crypto service
* rename 'user symmetric key' with 'user key'
* remove userId from browser crypto service
* updated EncKey to UserKey where applicable
* jsdoc deprecate account properties
* use encrypt service in crypto service
* use encrypt service in crypto service
* require key in validateUserKey
* check storage for user key if missing in memory
* change isPinLockSet to union type
* move biometric check to electron crypto service
* add secondary fallback name for bio key for safari
* migrate master key if found
* pass key to encrypt service
* rename pinLock to pinEnabled
* use org key or user key for encrypting attachments
* refactor makeShareKey to be more clear its for orgs
* rename retrieveUserKeyFromStorage
* clear deprecated keys when setting new user key
* fix cipher service test
* options is nullable while setting user key
* more crypto service refactors
- check for auto key when getting user key
- consolidate getUserKeyFromMemory and FromStorage methods
- move bio key references out of base crypto service
- update either pin key when setting user key instead of lock component
- group deprecated methods
- rename key legacy method
* Feature/PM-1049 - TDEFflow 3 login decryption options - PR feedback changes (#5642)
* PM-1049 - PR Feedback change - Browser - replace incorrect use of routerlink with manual attribute styling to keep anchor styling + tab focus while not having a router action race condition for the log out action to complete.
* PM-1049 - PR Feedback - State Service changes - rename get/setAcctDecryptionOptions to get/setAccountDecryptionOptions
* PM-1049 - PR Feedback changes - LoginDecryptionOptionsComp - Remove unncessary appA11yTitle directives as title / aria text would be identical to the displayed inner button text.
* DeviceType - Create sets of device types which other components can reference to avoid having to manually define groups of device types.
* PM-1049 - PR Feedback Changes - Update base-login-decryption-options component to leverage async piped observables per best practices. Updated all client templates to leverage new data streams.
* PM-1049 - BaseLoginDecryptionOptionsComp - Add validation service for generic error handling
* PM-1049 - DeviceResponse mistakenly had name as a number instead of a string
* PM-1049 - First draft of creating observable based data store service for Devices so that the base login comp can leverage it instead of calling the devices API service directly (as it will be moved into the SDK in the future).
* PM-1049 - Register new DevicesService on jslib-services module for use in components.
* PM-1049 - Add new hasDevicesOfTypes call to devices data store svc + devices API service.
* PM-1049 - BaseLoginDecryptionOptionsComp - wire up call to devicesService.hasDevicesOfTypes to replace getDevices() to avoid bringing down all trusted device information unnecessarily.
* PM-1049 - LoginDecryptionOptionsComp - Web HTML - clean up loading state so it displays spinner centered properly.
* PM-1049 - LoginDecryptionOptionsComp - Desktop HTML - Don't show login initiated title while page is loading to match other clients behavior.
* PM-1049 - Devices Services - Update naming of hasDevicesOfTypes to match new name on back end + route change to getDevicesExistenseByTypes
* PM-1049 - Device Response & View models - remove keys which are going to be deprecated on the base model
* PM-1049 - DevicesService - devicesBSubject --> devicesSubject rename per PR feedback
* PM-1049 - Devices Services - correct spelling of existence (*facepalm*)
* PM-1049 - Update comment for clarity per PR feedback
* PM-1049 - DevicesSvc - UserSymKey --> UserKey rename
* PM-1049 - BaseLoginDecryptionOptions - replace user email source - get from stateService vs tokenService.
* PM-1049 - BaseLoginDecryptionOptions - Remove uncessary check for userEmail as we will always have it here otherwise everything in the app is broken.
* PM-1049 - BaseLoginDecryptionOptions - Finish cleaning up removal of user email from showReqAdminApprovalBtn$ stream
* PM-1049 - LoginDecryptionOptionsComp - HTML revisions in web & browser to better space out buttons using tailwind or top margin to avoid need for multiple async pipes and shareReplay.
* PM-1049 - DevicesService - of course all observables should have $ suffix. Facepalm.
* PM-1049 - BaseLoginDecryptionOptionsComp - Update verbiage and style of destroy observable used for hooking into ngOnDestroy lifecycle to clean up all observables
* PM-1049 - BaseLoginDecryptionOptions - PR feedback changes - refactor user email to have an underlying bSubject stream to ensure subscription/promise execution separately from the template async pipe subscribing to the stream.
* PM-1049 - DevicesApiService - getDevicesExistenceByTypes - PR feedback - explicitly convert result to boolean instead of casting.
* PM-1049 - BaseLoginDecryptionOptionsComp - Add ShareReplay for getAccountDecryptionOptions + context per PR feedback
* PM-1049 - LoginDecryptionOptionsComp - Completely back away from template async pipe reactive approach as it caused massively increased complexity for little gain. Instead, just focus on reactively pulling asynchronously retrieved data and setting page loading state simply. This just works and is so much less overhead. + Add comments re flows of the component to be done later
* PM-1049- Revert DevicesService implementation from smart data store cache service giant mess into simple, clean data passthrough service to avoid complexity and keep moving forward. YAGNI
Co-authored-by: Andreas Coroiu <andreas@andreascoroiu.com>
* PM-1049 - DeviceCryptoService - Add decryptUserKey method (WIP)
* PM-1049 - AccountDecryptionOptions - add get helpers for checking for trusted device / key connector decryption option existence.
* PM-1049 - SSO Login Strategy - added comments in setUserKey method for where we will probably be consuming device keys and determining if the device is trusted or not (i.e., if we can get a decrypted user sym key in memory)
* PM-1049 - DeviceCryptoSvc.decryptUserKey - Update method to properly use state service device key retrieval + add TODO to figure out what to do if user has previously had a device key and has cleared their local cache (which will result in the device being untrusted now)
* PM-1049 - SSO Login Strategy - add comment re future passkey login strategy support
* PM-2759 - SSO & 2FA components updated with v0 of navigation logic to send users to LoginDecryptionOptions
* PM-1049 - Account > AccountDecryptionOptions - can't create getter helper methods for determining if user has decryption options b/c of issues w/ account deserialization. Moving past b/c I can just easily check if the given options are not undefined.
* PM-2759 - Add TODOs for deprecation of id token response resetMasterPassword logic and replacement with use of accountDecryptionOptions
---------
Co-authored-by: Andreas Coroiu <andreas@andreascoroiu.com>
* revert sharing disk cache between contexts
* fix tests
* add better tests to crypto service
* add hack to get around duplicate instances of disk cache on browser
* prevent duplicate cache deletes in browser
* fix browser state service tests
* Feature/PM-1212 - TDE - Approve with master password flow (#5706)
* PM-1212 - StateSvc - Add getUserDeviceTrustChoice && setUserDeviceTrustChoice to persist user's choice in local storage in case of refresh on login approval screens (ex: lock)
* PM-1212 - DeviceCryptoSvc - Add getUserDeviceTrustChoice && setUserDeviceTrustChoice as state service is lower level service for caching
* PM-1212 - LoginDecryptionOptionsComp - Save result of rememberEmail checkbox into local storage via deviceCryptoService.setUserDeviceTrustChoice
* PM-1212 - Lock component - after user key is set, check if user chose to establish trust, and if they did, then establish trust and reset choice.
* PM-1212 - Update naming of methods per discussion with Jake + add comment explaining intended single use retrieval and need for resetting the value.
* DeviceCryptoService - Refactor - decryptUserKey --> decryptUserKeyWithDeviceKey to match crypto service refactor naming convention
* PM-1212 - Refactor State Service per PR feedback to store trustDeviceChoiceForDecryption on Account.settings b/c the temp setting is scoped to a user.
* PM-2759 - SSO & 2FA Navigation to TDE Comp - Needs more work - Found scenarios on web with 2FA in which the expected navigation doesn't work. Adding TODO to assist in fixing
* (1) Add Trust to DeviceCryptoService name
(2) Move DeviceTrustCryptoService under auth folder
* PM-1212 - Add tests for new getUserTrustDeviceChoiceForDecryption and setUserTrustDeviceChoiceForDecryption methods + TODOs for future tests.
* PM-1212- Renaming / moving DeviceTrustCryptoService broke all the things - fixed all the client builds.
* PM-1212- Copy doc comment to abstraction per PR feedback
* PM-1212 - BaseLoginDecryptionOptions comp - remove unncessary cast to form control as apparently reactive forms now properly derives types.
* [PM-1203] Replace MP confirmation with verification code (#5656)
* [PM-1203] feat: ask for OTP if user does not have MP
* [PM-1203] feat: add backwards compatibility for accounts/servers without decryption options
* [PM-1203] feat: move hasMasterPassword to user-verification.service
* [PM-1203] fix: remove duplicate implementation from crypto service
* [PM-1203] fix: cli build
* Tweak device trust crypto service implementation to match mobile late… (#5744)
* Tweak device trust crypto service implementation to match mobile latest which results in more single responsibility methods
* Update tests to match device trust crypto service implementation changes
* update comment about state service
* update pinLockType states and add jsdocs
* add missed pinLockType changes
* [PM-1033] Org invite user creation flow 1 (#5611)
* [PM-1033] feat: basic redirection to login initiated
* [PM-1033] feat: add ui for TDE enrollment
* [PM-1033] feat: implement auto-enroll
* [PM-1033] chore: add todo
* [PM-1033] feat: add support in browser
* [PM-1033] feat: add support for desktop
* [PM-1033] feat: improve key check hack to allow regular accounts
* [PM-1033] feat: init asymmetric account keys
* [PM-1033] chore: temporary fix bug from merge
* [PM-1033] feat: properly check if user can go ahead an auto-enroll
* [PM-1033] feat: simplify approval required
* [PM-1033] feat: rewrite using discrete states
* [PM-1033] fix: clean-up and fix merge artifacts
* [PM-1033] chore: clean up empty ng-container
* [PM-1033] fix: new user identification logic
* [PM-1033] feat: optimize data fetching
* [PM-1033] feat: split user creating and reset enrollment
* [PM-1033] fix: add missing loading false statement
* [PM-1033] fix: navigation logic in sso component
* [PM-1033] fix: add missing query param
* [PM-1033] chore: rename to `ExistingUserUntrustedDevice`
* PM-1033 - fix component templates to reference `ExistingUserUntrustedDevice` so clients can build
---------
Co-authored-by: Jared Snider <jsnider@bitwarden.com>
* remove extra partial key
* set master key on lock component
* rename key hash to password hash on crypto service
* fix cli
* rename enc user key setter in crypto service
* Adds Events & Human Readable Messages (#5746)
* [PM-1202] Hide the Master Password tab on Settings / Security (#5649)
* [PM-1203] feat: ask for OTP if user does not have MP
* [PM-1203] feat: get master password status from decryption options
* [PM-1203] feat: add backwards compatibility for accounts/servers without decryption options
* [PM-1203] feat: move hasMasterPassword to user-verification.service
* fix merge issues
* Change getUserTrustDeviceChoiceForDecryption / setUserTrustDeviceChoiceForDecryption to getShouldTrustDevice / setShouldTrustDevice (#5795)
* Auth/[PM-1260] - Existing User - Login with Trusted Device (Flow 2) (#5775)
* PM-1378 - Refactor - StateSvc.getDeviceKey() must actually convert JSON obj into instance of SymmetricCryptoKey
* TODO: BaseLoginDecryptionOptionsComponent - verify new user check doesn't improperly pick up key connector users
* PM-1260 - Add new encrypted keys to TrustedDeviceUserDecryptionOptionResponse
* PM-1260 - DeviceTrustCryptoSvc - decryptUserKeyWithDeviceKey: (1) update method to optionally accept deviceKey (2) Return null user key when no device key exists (3) decryption of user key now works in the happy path
* PM-1260 - LoginStrategy - SaveAcctInfo - Must persist device key on new account entity created from IdTokenResponse for TDE to work
* PM-1260 - SSO Login Strategy - setUserKey refactor - (1) Refactor existing logic into trySetUserKeyForKeyConnector + setUserKeyMasterKey call and (2) new trySetUserKeyWithDeviceKey method for TDE
* PM-1260 - Refactor DeviceTrustCryptoService.decryptUserKeyWithDeviceKey(...) - Add try catch around decryption attempts which removes device key (and trust) on decryption failure + warn.
* PM-1260 - Account - Add deviceKey to fromJSON
* TODO: add device key tests to account keys
* TODO: figure out state service issues with getDeviceKey or if they are an issue w/ the account deserialization as a whole
* PM-1260 - Add test suite for decryptUserKeyWithDeviceKey
* PM-1260 - Add interfaces for server responses for UserDecryptionOptions to make testing easier without having to use the dreaded any type.
* PM-1260 - SSOLoginStrategy - SetUserKey - Add check looking for key connector url on user decryption options + comment about future deprecation of tokenResponse.keyConnectorUrl
* PM-1260 - SSO Login Strategy Spec file - Add test suite for TDE set user key logic
* PM-1260 - BaseLoginStrategy - add test to verify device key persists on login
* PM-1260 - StateService - verified that settings persist properly post SSO and it's just device keys we must manually instantiate into SymmetricCryptoKeys
* PM-1260 - Remove comment about being unable to feature flag auth service / login strategy code due to circ deps as we don't need to worry about it b/c of the way we've written the new logic to be additive.
* PM-1260 - DevicesApiServiceImplementation - Update constructor to properly use abstraction for API service
* PM-1260 - Browser - AuthService - (1) Add new, required service factories for auth svc and (2) Update auth svc creation in main.background with new deps
* PM-1260 - CLI - Update AuthSvc deps
* PM-1260 - Address PR feedback to add clarity / match conventions
* PM-1260 - Resolving more minor PR feedback
* PM-1260 - DeviceTrustCryptoService - remove debug warn
* PM-1378 - DeviceTrustCryptoSvc - TrustDevice - Fix bug where we only partially encrypted the user key with the device public key b/c I incorrectly passed userKey.encKey (32 bytes) instead of userKey.key (64 bytes) to the rsaEncrypt function which lead to an encryption type mismatch when decrypting the user's private key with the 32 byte decrypted user key obtained after TDE login. (Updated happy path test to prevent this from happening again)
* PM-1260 - AccountKeys tests - add tests for deviceKey persistence and deserialization
* PM-1260 - DeviceTrustCryptoSvc Test - tweak verbiage per feedback
* PM-1260 - DeviceTrustCryptoSvc - Test verbiage tweak part 2
* Update apps/browser/src/background/service-factories/devices-api-service.factory.ts
per PR feedback
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
---------
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* Defect - LockComp - After setting user key, must AWAIT retrieval of user's previous choice to have trusted the device or not. (#5804)
* [PM-2928] [PM-2929] [PM-2930] Fixes for: [PM-1203] Replace MP confirmation with verification code (#5798)
* [PM-2928] feat: hide change email if user doen't have MP
* [PM-2929] feat: hide KDF settings if user doesn't have MP
* [PM-2930] feat: remove MP copy
* Removed self-hosted check from TDE SSO config. (#5837)
* [PM-2998] Move Approving Device Check (#5822)
* Switch to retrieving approving device from token response
- Remove exist-by-types API call
- Define `HasApprovingDevices` on TDE options
* Update Naming
* Update Test
* Update Missing Names
* [PM-2908] feat: show account created toast (#5810)
* fix bug where we weren't passing MP on Restart to migrate method in lock
* fix: buffer null error (#5856)
* Auth/[pm-2759] - TDE - SSO and 2FA routing logic (#5829)
* PM-2759 - SsoComp - (1) Temp remove all TDE routing logic (2) Refactor existing navigation logic via new component utility function navigateViaCallbackOrRoute
* PM-2759 - SSO Component - Create test suite for logIn logic
* PM-2759 - SsoComp Tests - add disclaimer regarding testing private methods and props
* PM-1259 - SSO Comp - Refactor LogIn method to use functions for each navigation case for improved readability
* PM-1259 - SSO Comp Tests - Add tests for error case during login + test for new handleLoginError logic
* PM-2759 - SsoComp - Deprecate resetMasterPassword and replace with AccountDecryptionOptions logic + update tests
* PM-2759 - SsoComp + tests - Add trusted device encryption first draft handling which has login success and force password reset handling
* PM-2759 - Minor SsoComp comment and method name tweaks
* PM-2759 - BaseTwoFactorComp - (1) Comment out TDE stuff for now (2) Add test suite (3) Replace global window in base comp constructor with angular injection token for window which follows best practices and allows for mocking so the comp can be unit tested
* PM-2759 - Update child 2FA components to use angular injection token for window like base comp
* PM-2759 - TwoFactorComp - Finish testing all logic in doSubmit
* PM-2759 - TwoFactorComponent - Refactor DoSubmit method logic into multiple simple functions to make logic easier to follow
* PM-2759 - Add newtrustedDeviceOption.hasManageResetPasswordPermission property to match server changes
* PM-2759 - Flag AuthResult.resetMasterPassword property as deprecated
* PM-2759 - SSO comp - TDE routing logic - User without MP and ResetPassword permission must set a MP
* PM-2759 - Update Sso Comp tests to reflect additionally added TDE > MP set required logic (when user has no MP but they can reset other user passwords)
* PM-2759 - SsoComp - Add comment explaining the happy paths better for TDE success navigation
* PM-2759 - SsoComp - Refactor isTrustedDeviceEncEnabled logic into own method
* PM-2759 - SsoComp - As the 2FA comp passes the org id through to each route, going to standardize on doing so across the board for now to avoid any tricky scenarios down the line where it is needed and it's not present
* PM-2759 - SsoComp - Finish renaming orgIdFromState to orgIdentifier
* PM-2759 - SsoComp - update tests for forcePasswordReset flows now passing orgIdentifier as query param
* PM-2759 - SsoComp Tests - Export mockAcctDecryptionOpts permutations so we can share them across SsoComp and TwoFactorComp tests
* PM-2759 - Refactor 2FA comp post login redirect logic to match SSO component + add TDE logic
* PM-2759 - SsoComp - Refactor tests a bit for improved re-use
* PM-2759 - Sso Comp tests - can't export consts from a spec file or the other spec files that import them will re-execute the whole test suite as a nested test suite. TIL.
* PM-2759 - TwoFactorComp tests - All existing navigation scenarios + new TDE scenarios should now be tested.
* PM-2759 - Web - 2FA comp - Fix build error b/c of renamed base comp prop (identifier --> orgIdentifier)
* PM-2759 - Fix SsoLogin strategy tests b/c they were broken w/ the addition of the HasManageResetPasswordPermission prop to the TrustedDeviceOption interface
* PM-2759 - Web TwoFactorComp - goAfterLogIn method must be an arrow function to inherit the parent base component scope so that important things like angular services can be defined. Web 2FA flow does not work without this being an arrow func.
* PM-2759 - Fix typo
* PM-2759 - SsoComp and TwoFactorComp tests - move service and other mocks into the top level before each to better ensure no crossover between test states per PR feedback
* PM-2759 - SsoComp - add clarity by refactoring unclear comment
* PM-2759 - SsoComp - Per excellent PR feedback, refactor if else statements to guard statements for better readability / design
* PM-2759 - TwoFactorComp - Replace ifs with guard statements
* PM-2759 - TwoFactorComp - add clarity to comment per PR feedback
* PM-2759 - Replace use of jest.Mocked with MockProxy per PR feedback
* PM-2759 - Use unknown over any per PR feedback
* Bypass Master Password Reprompt if a user does not have a MP set (#5600)
* Add a check for a master password in PasswordRepromptService.enabled()
* Add tests for enabled()
* Update state service method call
* Use UserVerificationService to determine if a user has a master password
* rename password hash to master key hash
* fix cli build from key hash renaming
* [PM-1339] Allow Rotating Device Keys (#5806)
* Merge remote-tracking branch 'origin/feature/trusted-device-encryption' into Auth/pm-1339/rotate-device-keys
* Implement Rotation of Current Device Keys
- Detects if you are on a trusted device
- Will rotate your keys of only this device
- Allows you to still log in through SSO and decrypt your vault because the device is still trusted
* Address PR Feedback
* Move Files to Auth Ownership
* fix: getOrgKeys returning null
* [PM-3143] Trusted device encryption: Refactor reset enroll service (#5869)
* create new reset enrollment service
* refactor: login decryption options according to TODO
* feat: add tests
* PM-3143 - Add override to overriden methods
---------
Co-authored-by: Jared Snider <jsnider@bitwarden.com>
* generate a master key from master password if needed (#5870)
* [PM-3120] fix: device key not being saved properly (#5882)
* Auth/pm 1050/pm 1051/remaining tde approval flows (#5864)
* fix: remove `Unauth guard` from `/login-with-device`
* [PM-3101] Fix autofill items not working for users without a master password (#5885)
* Add service factories for user verification services
* Update autofill service to check for existence of master password for autofill
* Update the context menu to check for existence of master password for autofill
* context menu test fixes
* [PM-3210] fix: use back navigation (#5907)
* Removed buttons (#5935)
* PM-2759 - Fix broken backwards compatibility for authResult.resetMast… (#5940)
* PM-2759 - Fix broken backwards compatibility for authResult.resetMasterPassword
* PM-2759 - Update TODO with specific tech debt task + target release date
* TDE - State Svc - setDeviceKey should support setting null for future support of clearing device key. (#5942)
* Check if a user has a mp before showing kdf warning (#5929)
* [PM-1200] Unlock settings changes for accounts without master password - clients (#5894)
* [PM-1200] chore: add comment for jake
* [PM-1200] chore: rename to `vault-timeout`
* [PM-1200] feat: initial version of `getAvailableVaultTimeoutActions`
* [PM-1200] feat: implement `getAvailableVaultTimeoutActions`
* [PM-1200] feat: change helper text if only logout is available
* [PM-1200] feat: only show available timeout actions
* [PM-1200] fix: add new service factories and dependencies
* [PM-1200] fix: order of dependencies
`UserVerificationService` is needed by `VaultTimeoutSettingsService`
* [PM-1200] feat: add helper text if no lock method added
* [PM-1200] refactor: simplify prev/new values when changing timeout and action
* [PM-1200] feat: fetch timeout action from new observable
* [PM-1200] refactor: make `getAvailableVaultTimeoutActions` private
* [PM-1200] feat: add test cases for `vaultTimeoutAction$`
* [PM-1200] feat: implement new timeout action logic
* [PM-1200] feat: add dynamic lock options to browser
* [PM-1200] feat: enable/disable action select
* [PM-1200] feat: add support for biometrics
* [PM-1200] feat: add helper text and disable unavailable options
* [PM-1200] feat: update action on unlock method changes
* [PM-1200] feat: update browser to use async pipe
* [PM-1200] fix: element not updating
* [PM-1200] feat: hide masterPassOnRestart pin option
* [PM-1200] feat: hide change master password from browser settins
* [PM-1200] feat: hide change master password from app menu
* [PM-1200] feat: logout if lock is not supported
* [PM-1200] feat: auto logout from lock screen if unlocking is not supported
* [PM-1200] feat: remove lock button from web menus
* Revert "[PM-1200] fix: element not updating"
This reverts commit b27f425f48570d0d5dbc9dedb9797023fef64d8b.
* Revert "[PM-1200] feat: update browser to use async pipe"
This reverts commit 766c15bc3dbadcf7dcef3053b148e7874f8939ce.
* [PM-1200] chore: add comment regarding detectorRef
* [PM-1200] feat: remove lock now button from browser settings
* [PM-1200] feat: add `userId` to unlock settings related methods
* [PM-1200] feat: remove non-lockable accounts from menu
* [PM-1200] fix: cli not building
---------
Co-authored-by: Todd Martin <tmartin@bitwarden.com>
Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>
* [PM-3215][PM-3289] Create MasterKey from Password If Needed (#5931)
* Create MasterKey from Password
- Check if the MasterKey is stored or not
- Create it if it's not
* Add getOrDeriveKey Helper
* Use Helper In More Places
* Changed settings menu to be enabled whenever the account is not locked. (#5965)
* [PM-3169] Login decryption options in extension popup (#5909)
* [PM-3169] refactor: lock guard and add new redirect guard
* [PM-3169] feat: implement fully rewritten routing
* [PM-3169] feat: close SSO window
* [PM-3169] feat: store sso org identifier in state
* [PM-3169] fix: tests
* [PM-3169] feat: get rid of unconventional patch method
* PM-3169 - SSO & 2FA Comps - Update naming of new callback to match existing pattern + add tests for callback logic execution.
* PM-3169 - Update LockGuard to have a special exception for allowing the TDE Login with MP flow
* PM-3169 - Per discussion w/ Jake and Justin, rename login-initiated guard to be tde decryption required guard (more named for functionality vs specific route)
* PM-3169 - Add some additional context to new redirect guard scenario
* PM-3169 - Per PR feedback, replace all callback types with Promise<void> as the return values are not being used.
* PM-3169 - StateSvc - Per PR feedback, update setUserSsoOrganizationIdentifier signature to explicitly use null instead of partial<string> which doesn't do anything
* PM-3169 - Replace onSuccessfulLogin type to compile
* PM-3169 - Add clarification comment for why we are not using a query param for persisting the org identifier
* PM-3169 - Per discussion with Justin, only use memory for SsoOrgId as we don't need to persist it beyond that; tested and it worked on all 3 clients for new user TDE creation
* PM-3169 - Add missing ssoIdentifierRequired translation to desktop and browser
* PM-3169 - After discussing with Justin again, we realized that memory doesn't work on desktop if user refreshes app or closes and re-opens it so must use disk.
* PM-3169 - Per PR feedback, remove hasEverHadUserKey logic as we can just leverage existing getUserKey method to check if we have a user key or not; tested all guards in browser and web with no issues
* PM-3169 - Per design discussion with Danielle, move account created toast after successful account creation vs on load of page.
---------
Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>
Co-authored-by: Jared Snider <jsnider@bitwarden.com>
* [PM-3314] Fixed missing MP prompt on lock component (#5966)
* Updated lock component to handle no master password.
* Added a comment.
* Add Missing Slash (#5967)
* Fix AdminAuthRequest Serialization on Desktop (#5970)
- toJSON isn't being called by ElectronStorageService
- Force it's conversion to JSON earlier so it happens for all storage methods
* Fix issue where we were incorrectly calling setRememberEmailValues in the AdminAuthRequest state - no need to do this as the email is already saved to state. By calling this method, we would actually overwrite the already saved email with null as the user's choice to remember email wasn't persisted through SSO on the login service. (#5972)
* PM-3329 - Restore everHadUserKey logic from PM-3169 which I incorrectly removed in order to fix routing logic so that user can lock and land on the lock screen properly (#5979)
* PM-3210 - TDE - LoginWithDevice routing fix - Mirror PR #5950 in just simply providing a back action on click which works for all app generated scenarios (#5982)
* PM-3332 - TDE - SsoLoginStrategy - For existing admin auth reqs, must… (#5980)
* PM-3332 - TDE - SsoLoginStrategy - For existing admin auth reqs, must manually handle 404 error case to prevent app from hanging and clear the local state if the admin auth req in the DB has been purged; i.e., it should fail silently.
* Add TODO for SSO Login Strategy tests
* PM-3331 - TDE - Firefox - Browser extension - fix access denied error… (#5984)
* PM-3331 - TDE - Firefox - Browser extension - fix access denied error on popup load which was caused by the canAccessFeature guard failing to lookup the TDE feature flag as the server config was returning null even after a successful server call as only returned the value if the user was unauthenticated for some reason
* PM-3331 - After discussion with Andre, further refactor ConfigService logic to always return the latest information from the server so that requests for feature flag data will always get the most up to date information.
* PM-3345 - TDE - Desktop - Biometrics setting submenu tweak - do not s… (#5988)
* PM-3345 - TDE - Desktop - Biometrics setting submenu tweak - do not show require MP or PIN entry on restart if user doesn't have at least one of those options b/c otherwise user can get into a bad state where they cannot unlock
* PM-3345 - TDE - Desktop - Settings comp - if user turns off PIN and Biometric is on + require PIN on restart is enabled then must turn that setting off to prevent bad user state
* PM-3345 - Final tweak to logic
* [PM-2852] Final merge from Key Migration branch to TDE Feature Branch (#5977)
* [PM-3121] Added new copy with exclamation mark
* [PM 3219] Fix key migration locking up the Desktop app (#5990)
* Only check to migrate key on VaultTimeout startup
* Remove desktop specific check
* PM-3332 - LoginWithDevice - Add error handling logic around admin auth request retrieval similar to sso login strategy to prevent error state and allow re-creation of an admin auth request if it has been purged from the server for whatever reason. (#5991)
* PM-3355 - TDE - Browser JIT Account Creation - Browser create user logic still had logic for simply closing the extension tab but as we no longer open the login decryption options in a tab we needed to update the logic here to navigate the user directly onto the vault. (#5993)
* Add distinctUntilChanged to fix multiple value changes for biometrics firing (#5999)
* Add optional chaining to master key (#6007)
* PM-3369 - TDE - Persist user's choice to trust device to state when user ma… (#6000)
* PM-3369 - Persist user's choice to trust device to state when user makes choice + persist previous choices out of state
* PM-3369 - Must set trust device in state on load if it's never been set before
* PM-3369 - Refactor BaseLoginDecOptions to properly set trust device choice in state on load
* Update libs/angular/src/auth/components/base-login-decryption-options.component.ts
Co-authored-by: Jake Fink <jfink@bitwarden.com>
---------
Co-authored-by: Jake Fink <jfink@bitwarden.com>
* Updated email change component to getOrDeriveMasterKey (#6009)
* [PM-3330] Force Update to Lockable Accounts on PIN/Biometric Update (#6006)
* Add Listener For Events that Need To Redraw the Menu
* Send redrawMenu Message When Pin/Biometrics Updated
* DeviceTrustCryptoService - don't worry about checking if a device should establish trust or not if the user doesn't have trusted device encryption on (#6010)
* Auth / pm 3351 / TDE Login - Browser & Desktop vault sync issue fix (#6002)
* PM-3351 - TDE Login on desktop and browser via SSO comp with no 2FA should trigger sync like standard onSuccessfulLogin process used to so user lands on vault with data.
* PM-3351 - 2FA Comp - Refactor onSuccessfulLogin logic to only execute in the success path just like the SSO component + adding specific onSuccessfulLoginTde flow just like SSO comp. + removed unnecessary calls to loginService.clearValues(). Added browser & desktop definitions for onSuccessfulLoginTde which is just a fullSync kick off.
* TODO
* PM-3351 - remove await to restore code back to previous state without hang.
* PM-3351 - 2FA Comp - Don't await onSuccessfulLoginTde b/c it causes a hang
* PM-3351 - remove sso comp incorrect todo
* PM-3351 - SsoComp - don't await onSuccessfulLoginTde for browsers sake
* PM-3351 - SsoComp - remove awaits from onSuccessfulLoginTde and onSuccessfulLogin to avoid any hangs on desktop and browser
* PM-3351 - Convert onSuccessfulLoginTde to promise<void> as its return is not used + refactor all to be consistent and clearly communciate that the sync won't be awaited.
* PM-3351 - Convert onSuccessfulLogin to promise<void> and update all methods accordingly to more clearly indicate that the syncs and any other logic won't be awaited.
* [PM-3356] Fallback to OTP When MasterPassword Hasn't Been Used (#6017)
* Fallback to OTP When MasterPassword Hasn't Been Used
* Update Test and Rename Method
* Revert "DeviceTrustCryptoService - don't worry about checking if a device should establish trust or not if the user doesn't have trusted device encryption on (#6010)" (#6020)
This reverts commit 6ec22f9570.
* PM-3390 - TDE - Redraw desktop after user creation to update isLocked checks and get menu to be enabled properly (#6018)
* [PM-3383] Hide Change Password menu option for user with no MP (#6022)
* Hide Change Master Password menu item on desktop when a user doesn't have a master password.
* Renamed variable for consistency.
* Updated to base logic on account.
* Fixed menubar
* Resolve merge errors in crypto service spec
* Fixed autofill to use new method on userVerificationService (#6029)
* PM-3456 - TDE Admin Auth Req Flow - FF dead object issue - The foreground popup must retrieve the long lived background services for the new TDE services (the AuthRequestCryptoService service fixes this issue, but the DeviceTrustCryptoService should have been added to services.module as well) (#6037)
* skip auto key check when using biometrics on browser (#6041)
* Added comments for backward compatibility removal. (#6039)
* Updated warning message. (#6059)
* Tde pr feedback (#6051)
* move pin migration to the crypto service
* refactor config service logic
* refactor lock component load logic
* rename key connector methods
* add date to backwards compat todo
* update backwards compat todo
* don't specify defaults in redirectGuard
* nit
* add null & undefined check for userid before using the account
* fix ui tests
* add todo for tech debt
* add todo comment
* Fix storybook per PR feedback
* Desktop & Browser - lock comp - add optional chaining check for focusable input - user can just have biometric and not have a MP or a PIN so must support that.
* Main.background.ts - remove duplicate instantiations of the userVerificationApiService and userVerificationService which were added in two separate PRs
* Per PR feedback - (1) Browser app routing module - fix incorrect import for redirect guard (2) Created index.ts file for auth guards to simplify imports and updated imports
* Per PR feedback, (1) Update jslib-services.module to provide actual instance of VaultTimeoutService (2) Update init service to use concrete VaultTimeoutService vs abstraction.
Co-authored-by: Matt Gibson <git@mgibson.dev>
* Per PR feedback - update services module AuthRequestCryptoService and DeviceTrustCryptoService to use shorthand format.
* Per PR feedback, add devicesService to main background and update services module to ensure the popup leverages the background devicesService
---------
Co-authored-by: Jared Snider <jsnider@bitwarden.com>
Co-authored-by: Matt Gibson <git@mgibson.dev>
* Updated message keys for CrowdIn to pick them up. (#6066)
* TDE PR Feedback resolutions round 2 (#6068)
* Per PR feedback - main.background.ts - move userVerificationService and userVerificationApiService to correct location
* Per PR feedback - JS lib services + vault timeout service updates - (1) Correctly type callbacks based on injection tokens (2) Update vault timeout service to have proper types based on injection tokens
* Per PR Feedback - update web init service to inject actual VaultTimeoutService vs abstraction similar to what we did for desktop here: 55a797d4ff
* Per more feedback - revert incorrect changes to VaultTimeoutService based on existing injection token types for LOGOUT_CALLBACK and LOCKED_CALLBACK.. and instead update the injection token types themselves to match how they are being used.
* Per PR feedback - in browser main.background.ts, inject concrete VaultTimeoutService instead of abstraction so we don't have to cast it anymore (matching web & desktop)
---------
Co-authored-by: Jared Snider <jsnider@bitwarden.com>
Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>
Co-authored-by: Jacob Fink <jfink@bitwarden.com>
Co-authored-by: Matt Gibson <MGibson1@users.noreply.github.com>
Co-authored-by: Andreas Coroiu <andreas.coroiu@gmail.com>
Co-authored-by: Andreas Coroiu <andreas@andreascoroiu.com>
Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Co-authored-by: André Bispo <abispo@bitwarden.com>
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
Co-authored-by: Matt Gibson <git@mgibson.dev>
* Implement ProtonPass json importer
* Add protonpass-importer json type definition
* Fix alphabetical order in importer imports
* Add importer error message for encrypted protonpass imports
* Add i18n to protonpass importer
* Add protonpass (zip) importer
* Fix protonpass importer
* Add unit tests for protonpass importer
* Make protonpass importer not discard totp codes
* Merge protonpass json & zip importers
* Add protonpass creditcard import & fix note import
* Fix protonpass zip import not recognizing zip files on windows/chrome
* Make protonpass importer use vault types
* Make protonpass importer treat vaults as folders
* Make protonpass importer treat folders as collections for organizations
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* Add types to protonpass test data
* Fix protonpass importer's moveFoldersToCollections
* Add tests for folders/collections
* Remove unecessary type cast in protonpass importer
* Remove unecessary type annotations in protonpass importer
* Add assertion for credit card cvv in protonpass importer
* Handle trashed items in protonpass importer
* Fix setting expiry month on credit cards
* Fix wrong folder-assignment
Only the first item of a "vault" was getting assigned to a folder
Extend unit tests to verify behaviour
---------
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith@web.de>
* Update npm minor
* Do not update past prettier major version
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
* Change everything to Uint8Array
related to https://github.com/jestjs/jest/issues/14379
* Work on failing type tests
* Revert changes to custom matcher setup
* Remove last BufferArrays from tests
* Fix custom matcher type errors in vscode
* Remove errant `.buffer` calls on Uint8Arrays
* Encryption Pair should serialize Array Buffer and Uint8Array
* Fix EncArrayBuffer encryption
---------
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
* Extract passwordStrength from passwordGenerationService
Extract passwordStrength from password-generation.service.ts
Create new password-strength.service.ts
Create new password-strength.service.abstraction.ts
Register new password-strength service
Fix usages in libs
* Fix usage in web
* Fix usage in desktop
* Fix usage in CLI
* Fix usage in browser
Move password-generation-factory to tools
* Fix tests
* Change dependency in jslib-services.module
* Rename service-factory folder
* Move cryptographic service factories
* Move crypto models
* Move crypto services
* Move domain base class
* Platform code owners
* Move desktop log services
* Move log files
* Establish component library ownership
* Move background listeners
* Move background background
* Move localization to Platform
* Move browser alarms to Platform
* Move browser state to Platform
* Move CLI state to Platform
* Move Desktop native concerns to Platform
* Move flag and misc to Platform
* Lint fixes
* Move electron state to platform
* Move web state to Platform
* Move lib state to Platform
* Fix broken tests
* Rename interface to idiomatic TS
* `npm run prettier` 🤖
* Resolve review feedback
* Set platform as owners of web core and shared
* Expand moved services
* Fix test types
---------
Co-authored-by: Hinton <hinton@users.noreply.github.com>
This PR introduces a generic `DialogService` which can be used by all the clients. This allows us to decouple dialogs from the `PlatformUtilsHelper`.
The `DialogService` provides a new method, `openSimpleDialog` which is the new interface for that type of dialogs.
This gives us 3 different implementations:
- Web: DialogService modern dialogs
- Browser: SweetAlert
- Desktop: Native electron based
Upgrade Electron to version 24, node to 18 and npm to 9. Electron changed to using node 18 in 23, with node 18 using npm 9 as default.
There doesn't seem to be any breaking changes except the deprecation of Windows 7, 8.1, and Server 2012. A somewhat undocumented breaking change was that elements in the title bar are now draggable which broke the account switching selector. Resolved by adding a no-drag css rule.
- electronjs.org/blog/electron-22-0
- electronjs.org/blog/electron-23-0
- electronjs.org/blog/electron-24-0
* Create and register new libs/exporter
Create package.json
Create tsconfig
Create jest.config
Extend shared and root tsconfig and jest.configs
Register with eslint
* Migrate exportService to libs/exporter
Move exportService (abstraction and impl) into libs/exporter
Refactored exportService to be split into vault-export and event-export
Created barrel-files for both exports
Moved export.service.spec.ts into vault-export
Created an export-helper, which helps build the filename (extract method refactor from ExportService)
* Move components in libs/angular into tools-subfolder
Moved components
Updated imports in jslib-services.module and jslib.module
* Register libs/exporter with browser and fix imports
Move export.component into tools-subfolder
* Register libs/exporter with cli and fix imports
Move export.command into tools-subfolder
* Register libs/exporter with desktop and fix imports
Move export.component into tools-subfolder
* Move export models to libs/exporter
* Update web imports
* Update package-lock.json
* Move export models back as it would create circular dependency
Reponse models in common rely on export models which are in libs/exporter, which relies on common
* Fix up web for event-export
* Update CODEOWNERS
* Add export-models to team-tools-dev
* Simplify domain import
* Moving EventExport into web
* Fail on unsupported export format
Issue #5194: https://github.com/bitwarden/clients/issues/5194
The cli previously would take any value for the export format and
default to unencrypted json if it wasn't a supported format. This
behavior is a little dangerous because if for instance typed
"json_encrypted" instead of "encrypted_json" and naively saved the file
you might be surprised to learn the payload was not actually encrypted
even though the command completed successfully.
This change adds a guard clause when converting the string value passed
in via `--format` into the type `ExportFormat` to ensure that the format
provided is one of the supported types.
* Move isSupportedExportFormat to private method
* [EC-1070] Introduce flag for enforcing master password policy on login
* [EC-1070] Update master password policy form
Add the ability to toggle enforceOnLogin flag in web
* [EC-1070] Add API method to retrieve all policies for the current user
* [EC-1070] Refactor forcePasswordReset in state service to support more options
- Use an options class to provide a reason and optional organization id
- Use the OnDiskMemory storage location so the option persists between the same auth session
* [AC-1070] Retrieve single master password policy from identity token response
Additionally, store the policy in the login strategy for future use
* [EC-1070] Introduce master password evaluation in the password login strategy
- If a master password policy is returned from the identity result, evaluate the password.
- If the password does not meet the requirements, save the forcePasswordReset options
- Add support for 2FA by storing the results of the password evaluation on the login strategy instance
- Add unit tests to password login strategy
* [AC-1070] Modify admin password reset component to support update master password on login
- Modify the warning message to depend on the reason
- Use the forcePasswordResetOptions in the update temp password component
* [EC-1070] Require current master password when updating weak mp on login
- Inject user verification service to verify the user
- Conditionally show the current master password field only when updating a weak mp. Admin reset does not require the current master password.
* [EC-1070] Implement password policy check during vault unlock
Checking the master password during unlock is the only applicable place to enforce the master password policy check for SSO users.
* [EC-1070] CLI - Add ability to load MP policies on login
Inject policyApi and organization services into the login command
* [EC-1070] CLI - Refactor update temp password logic to support updating weak passwords
- Introduce new shared method for collecting a valid and confirmed master password from the CLI and generating a new encryption key
- Add separate methods for updating temp passwords and weak passwords.
- Utilize those methods during login flow if not using an API key
* [EC-1070] Add route guard to force password reset when required
* [AC-1070] Use master password policy from verify password response in lock component
* [EC-1070] Update labels in update password component
* [AC-1070] Fix policy service tests
* [AC-1070] CLI - Force sync before any password reset flow
Move up the call to sync the vault before attempting to collect a new master password. Ensures the master password policies are available.
* [AC-1070] Remove unused getAllPolicies method from policy api service
* [AC-1070] Fix missing enforceOnLogin copy in policy service
* [AC-1070] Include current master password on desktop/browser update password page templates
* [AC-1070] Check for forced password reset on account switch in Desktop
* [AC-1070] Rename WeakMasterPasswordOnLogin to WeakMasterPassword
* [AC-1070] Update AuthServiceInitOptions
* [AC-1070] Add None force reset password reason
* [AC-1070] Remove redundant ForcePasswordResetOptions class and replace with ForcePasswordResetReason enum
* [AC-1070] Rename ForceResetPasswordReason file
* [AC-1070] Simplify conditional
* [AC-1070] Refactor logic that saves password reset flag
* [AC-1070] Remove redundant constructors
* [AC-1070] Remove unnecessary state service call
* [AC-1070] Update master password policy component
- Use typed reactive form
- Use CL form components
- Remove bootstrap
- Update error component to support min/max
- Use Utils.minimumPasswordLength value for min value form validation
* [AC-1070] Cleanup leftover html comment
* [AC-1070] Remove overridden default values from MasterPasswordPolicyResponse
* [AC-1070] Hide current master password input in browser for admin password reset
* [AC-1070] Remove clientside user verification
* [AC-1070] Update temp password web component to use CL
- Use CL for form inputs in the Web component template
- Remove most of the bootstrap classes in the Web component template
- Use userVerificationService to build the password request
- Remove redundant current master password null check
* [AC-1070] Replace repeated user inputs email parsing helpers
- Update passwordStrength() method to accept an optional email argument that will be parsed into separate user inputs for use with zxcvbn
- Remove all other repeated getUserInput helper methods that parsed user emails and use the new passwordStrength signature
* [AC-1070] Fix broken login command after forcePasswordReset enum refactor
* [AC-1070] Reduce side effects in base login strategy
- Remove masterPasswordPolicy property from base login.strategy.ts
- Include an IdentityResponse in base startLogin() in addition to AuthResult
- Use the new IdentityResponse to parse the master password policy info only in the PasswordLoginStrategy
* [AC-1070] Cleanup password login strategy tests
* [AC-1070] Remove unused field
* [AC-1070] Strongly type postAccountVerifyPassword API service method
- Remove redundant verify master password response
- Use MasterPasswordPolicyResponse instead
* [AC-1070] Use ForceResetPassword.None during account switch check
* [AC-1070] Fix check for forcePasswordReset reason after addition of None
* [AC-1070] Redirect a user home if on the update temp password page without a reason
* [AC-1070] Use bit-select and bit-option
* [AC-1070] Reduce explicit form control definitions for readability
* [AC-1070] Import SelectModule in Shared web module
* [AC-1070] Add check for missing 'at' symbol
* [AC-1070] Remove redundant unpacking and null coalescing
* [AC-1070] Update passwordStrength signature and add jsdocs
* [AC-1070] Remove variable abbreviation
* [AC-1070] Restore Id attributes on form inputs
* [AC-1070] Clarify input value min/max error messages
* [AC-1070] Add input min/max value example to storybook
* [AC-1070] Add missing spinner to update temp password form
* [AC-1070] Add missing ids to form elements
* [AC-1070] Remove duplicate force sync and update comment
* [AC-1070] Switch backticks to quotation marks
---------
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>