* Require init in i18n service.
this is needed to load translations and set translation locale
* No longer need to cast i18n
* Expose user preferred locale in i18nService
This is for correctly displaying `default` when no locale has been set in preferences components. The `locale$` observable should always resolve to the currently locale currently being translated to.
Use SafeProvider as a factory for all our providers to ensure
that the DI token, implementation, and deps all match.
---------
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
* create domain settings state provider
* replace callsites for defaultUriMatch and neverDomains with DomainSettingsService equivalents
* replace callsites for equivalentDomains with DomainSettingsService equivalents and clean up unused AccountSettingsSettings
* add migrations for domain settings state
* do not use enum for URI match strategy constants and types
* add getUrlEquivalentDomains test
* PR suggestions/cleanup
* refactor getUrlEquivalentDomains to return an observable
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Co-authored-by: ✨ Audrey ✨ <ajensen@bitwarden.com>
* update tests
* add UriMatchStrategy docs notes
* service class renames
* use service abstraction at callsites previously using service class directly
---------
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Co-authored-by: ✨ Audrey ✨ <ajensen@bitwarden.com>
* Use state provider to store preferred language
* migrate preferred language
* Use new i18n provider to get LOCAL_ID
* Fix preloaded english i18n
This is a mock service that forces english translations, it doesn't need the i18n interface that allows changing of locales.
* PR improvements
* Fixup merge
* [deps] Platform: Update Rust crate libsecret to v0.5.0
* Update gio to match with the version from libsecret
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel García <dani-garcia@users.noreply.github.com>
Turns out the HCaptcha accessibility feature on desktop stopped working a while back. This PR resolves it and tweaks the implementation to use norefeerer and noopener for improved sandboxing. This comes with the slight tweak in behaviour namely we now get the cookie when you click the back button.
To fix hcaptcha not working I needed to use the correct session storage.
* [deps] Tools: Update electron to v28.2.6
* Update version in electron-builder.json
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* Migrate existing provider data to StateProvider
Migrate existing provider data to StateProvider
* Rework the ProviderService to call StateProvider
* Unit test the ProviderService
* Update DI to reflect ProviderService's new args
* Add ProviderService to logout chains across products
* Remove provider related stateService methods
* Update libs/common/src/state-migrations/migrations/28-move-provider-state-to-state-provider.spec.ts
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* Cover up a copy/paste job
* Compare equality over entire array in a test
---------
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* Revert "[PM-5277] Migrate Sync Service to State Provider (#7680)"
This reverts commit 78008a9e1e.
Includes a noop migration builder that allows us to bridge over the deleted migration
* Prefer revert migrations to noop
this revert avoids the need to change behavior between released vs unreleased migrations and keeps some dangerous code out of the repo :success:
* Update ordering of badge settings migrator to be consistent with `rc`, which was cut with only up to version 25
* Fix missing type import
* [deps] Tools: Update electron to v28.2.5
* Update version in electron-builder.json
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* Establish biometric unlock enabled in state providers
* Use biometric state service for biometric state values
* Migrate biometricUnlock
* Fixup Dependencies
* linter and import fixes
* Fix injection
* Fix merge
* Use boolean constructor as mapper
* Conform to documented test naming conventions
* Commit documentation suggestion
Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
* Fix merge commit
* Fix test names
---------
Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
* [deps] Tools: Update electron-builder to v24
* Add ElectronTeamID
* Remove double signing and use the proper extraFiles for safari extension
* Revert "Remove double signing and use the proper extraFiles for safari extension"
This reverts commit 94635dbd02.
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hinton <hinton@users.noreply.github.com>
Co-authored-by: Daniel James Smith <2670567+djsmith85@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* 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
* [deps] Tools: Update electron to v28.2.4
* Bump version in electron-builder.json
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* migrate clearClipboard account setting to autofill settings state provider
* replace state service get/set clearClipboard with autofill settings service equivalents
* PR suggestions cleanup
* Fix nextMock arguments
* Add state for biometric prompts
* Use biometric state for prompts
* Migrate biometric prompt data
* wire up biometric state to logouts
* Add migrator to migrate list
* Remove usages of prompt automatically
Explicitly list non-nulled state as intentional
* `npm run prettier` 🤖
* Fix web lock component
* create key generation service
* replace old key generation service and add references
* use key generation service in key connector service
* use key generation service in send service
* user key generation service in access service
* use key generation service in device trust service
* fix tests
* fix browser
* add createKeyFromMaterial and tests
* create ephemeral key
* fix tests
* rename method and add returns docs
* ignore material in destructure
* modify test
* specify material as key material
* pull out magic strings to properties
* make salt optional and generate if not provided
* fix test
* fix parameters
* update docs to include link to HKDF rfc
* Create state for biometric client key halves
* Move enc string util to central utils
* Provide biometric state through service
* Use biometric state to track client key half
* Create migration for client key half
* Ensure client key half is removed on logout
* Remove account data for client key half
* Remove unnecessary key definition likes
* Remove moved state from account
* Fix null-conditional operator failure
* Simplify migration
* Remove lame test
* Fix test type
* Add migrator
* Remove state that is never read.
* Remove unnecessary biometric state
We don't need to determine platform in desktop background, it can be done in the UI at any time.
* Fix merge
* Use platform utils to identify OS desktop type
* [deps] Tools: Update electron to v28.2.3
* Bump version in electron-builder
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* enable duo for desktop
* added missing return path in main.ts
* updated logic in component
* removed switch added await; updated logic in main.
* addressed subscription concerns in main; updated formatting in 2fa component
* Update Duo case in locales
* 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>
* [deps] Tools: Update electron to v28.2.2
* Bump version in electron-builder.json
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* [AC-1124] Add getManyFromApiForOrganization to cipher.service.ts
* [AC-1124] Use getManyFromApiForOrganization when a user does not have access to all ciphers
* [AC-1124] Vault changes
- Show new collection access restricted view
- Include unassigned ciphers for restricted admins
- Restrict collections when creating/cloning/editing ciphers
* [AC-1124] Update edit cipher on page navigation to check if user can access the cipher
* [AC-1124] Hide ciphers from restricted collections
* [AC-1124] Ensure providers are not shown collection access restricted view
* [AC-1124] Modify add-edit component to call the correct endpoint when a restricted admin attempts to add-edit a cipher
* [AC-1124] Fix bug after merge with main
* [AC-1124] Use private this._organization
* [AC-1124] Fix broken builds
* create sso service
* rename sso service to sso-login service
* rename service
* add references to sso login service and update state calls
* fix browser
* fix desktop
* return promises
* remove sso state from account and global objects
* more descriptive org sso identifier method names
* fix sso tests
* fix tests
* Disable node integration and enable context isolation
* Review comments
* Log in renderer through IPC
* Missed imports
* Mock electron API
* resourcesPath is undefined in the preload, but process.windowsStore works correctly
* Replace fromBufferToUtf8 conditional implementation for the `buffer` package
The current non-node implementation is different than the node implementation,
as the non-node would break when the contents can't be parsed as a URI component.
Replacing the impl by the `buffer` package makes the result match in both environments.
* Fix lint
* Add some more tests
* Remove buffer from devDependencies
* [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
* 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>
* Create state for biometric client key halves
* Move enc string util to central utils
* Provide biometric state through service
* Use biometric state to track client key half
* Create migration for client key half
* Ensure client key half is removed on logout
* Remove account data for client key half
* Remove unnecessary key definition likes
* Remove moved state from account
* Fix null-conditional operator failure
* Simplify migration
* Remove lame test
* Fix test type
* Add migrator
* Prefer userKey when legacy not needed
* Fix tests
* [deps] Tools: Update electron to v28.2.1
* Bump version in electron-builder.json
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* Fix calling init() on undefined in biometrics.service.ts
* Add guard on osSupportsBiometric
* Create NoopBiometricsService instead of method guards
---------
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* Checking type instead of send.type on send's add-edit.component
* Fix linting issues
---------
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* PM-5242 - First working draft of copying out web CL implementation of user verification form and dialog components into standalone libs/auth components which could be used in any client.
* PM-5242 - Rename UserVerificationFormComponent to UserVerificationFormInputComponent b/c it doesn't actually have a form and is meant to slot into a form as an input.
* PM-5242 - Update libs/auth angular index to take renamed component into account
* PM-5242 - Clean up UserVerificationDialogComponent as have much cleaner design approach now (maintain existing func while simply adding new requirements for client side validation for passkeys)
* PM-5242 - UserVerificationFormInput component - WIP draft of new client and server split of user verification logic
* PM-5242 - UserVerificationFormInput - WIP - Lots of progress on client side verification layout - more to do
* PM-5242 - UserVerificationFormInputComponent - Add hasMultipleVerificationMethods property so we can only show alternate methods if user has them.
* PM-5242 - UserVerificationFormInputComponent - rename hasMultipleVerificationMethods to hasMultipleClientVerificationOptions
* PM-5242 - Add new user verification biometrics fingerprint icon with proper secondary fill so it displays properly on all themes.
* PM-5242 - Create enum for tracking client user verification states
* PM-5242 - UserVerificationFormInputComponent - WIP - (1) Got biometrics layout working except for error state (2) Emitting active client verification option and biometrics result to dialog (3) Properly identifying if biometrics is enabled in a platform agnostic way (4) Translations TODO
* PM-5242 - UserVerificationDialogComponent - (1) Wire up new inputs and outputs for UserVerificationFormInput (2) Don't show submit button when clientside biometrics verification active
* PM-5242 - UserVerificationFormInputComponent - wired up biometrics failure and retry handling + re-arranged comp properties to put inputs & outputs at the top
* PM-5242 - UserVerificationFormInput component - Add logic to prevent currently active client verification method from being shown an option
* PM-5242 - UserVerificationFormInput - adjust margins
* PM-5242 - User verification dialog and form input comps - replace Verification with VerificationWithSecret type where applicable
* PM-5242 - UserVerificationFormComp - Default to server for backwards compatibility and to avoid requiring the input at all
* PM-5242 - UserVerificationFormInputComp - (1) Rename processChanges to processSecretChanges (2) Short circuit processSecretChanges when biometrics is active (3) Add new function for determining type of verification that has a secret.
* PM-5242 - UserVerificationDialog - Support custom, optional callout in dialog body.
* PM-5242 - UserVerificationDialogComp - support custom confirm button text and type.
* PM-5242 - UserVerificationDialog - Add user verification dialog result type to allow for handling all possible verification scenarios
* PM-5242 - UserVerificationFormInputComp - tweak comment
* PM-5242 - UserVerificationFormInput comp html - add placeholder text for no client verifications found scenario
* PM-5242 - UserVerificationDialogComponent - (1) Add confirm & cancel to dialog result (2) Add cancel method vs using bitDialogClose for specificity (3) Adjust naming of output property to properly specify that it is scoped to client verification (4) Adjust layout of dialog html to handle when no client side verification methods are found.
* PM-5242 - UserVerificationFormInput - Clean up test code
* PM-5242 - UserVerificationFormInput - For server verification, we don't need to check if the user has a local master key hash as we will generate a hash to send to the server for comparison.
* PM-5242 - UserVerificationFormInput html - Remove now unnecessary dev warning as I've provided a default
* PM-5242 - UserVerification Dialog & Form Input - add translations on all clients for all visible text.
* PM-5242 - UserVerificationFormInput html - remove no active client verification handling from form input comp as it is instead emitted upwards to parent dialog component to be handled there.
* PM-5242 - UserVerificationDialogComp - (1) Make UserVerificationDialogResult.noAvailableClientVerificationMethods optional because it isn't needed in cancel flows (thanks Will) (2) Modify static open to intercept closed observable event in order to always return a UserVerificationDialogResult as BitDialog returns empty string when the user clicks the x
* PM-5242 - UserVerificationDialogComp - Simplify dialog param names to remove redundant dialog
* PM-5242 - UserVerificationDialogParams - update comments to match new names
* PM-5242 - UserVerificationDialog Storybook - WIP first draft
* PM-5242 - UserVerificationDialogStoryComponent - WIP - try out having imports the same as the standalone component
* PM-5242 - UserVerificationDialogStoryComponent - more WIP - building now - some stuff displaying
* PM-5242 - UserVerificationDialogStoryComponent - some progress on providers setup
* PM-5242 - Not going to use storybook for user verification dialog
* PM-5242 - UserVerificationDialogComp - move types into own file + add docs
* PM-5242 - Update auth index to export user-verification-dialog.types
* PM-5242 - UserVerificationFormInput & UserVerificationService - Extract out getAvailableVerificationOptions logic into service
* PM-5242 -UserVerificationDialogComponent - Update close logic to handle escape key undefined scenario
* PM-5242 - UserVerificationFormInput - add getInvalidSecretErrorMessage for properly determining invalid secret translation
* PM-5242 - UserVerificationDialogComp - Refactor submit logic to handle different return methodologies in existing MP and OTP user verification service code vs new PIN flow (e.g., throwing an error instead of returning false)
* PM-5242 - PinCryptoService - change error logs to warnings per discussion with Justin
* PM-5242 - UserVerificationFormInput - Biometrics flow on desktop - remove accidentally added period in couldNotCompleteBiometrics translation key.
* PM-5242 - UserVerificationFormInput HTML - Re-arrange order of other client verification options to match design
* PM-5242 - UserVerificationFormInputComponent - Reset inputs as untouched on change of client verification method.
* PM-5242 - UserVerificationDialogComponent - Remove TODO as existing secret change logic turns invalidSecret false when biometrics is swapped to.
* PM-5242 - UserVerificationFormInputComponent - getInvalidSecretErrorMessage - fix PIN error message not being returned.
* PM-5242 - UserVerificationDialogComponent - Add documentation and examples to open method.
* PM-5242 - UserVerificationDialogComponent - tweak open docs
* PM-5242 - Remove accidental period from translation keys on browser & web
* PM-5242 - UserVerificationFormInputComponent - OTP flow needed button module to work
* PM-5242 - UserVerificationDialogParams - Add docs explaining that noAvailableClientVerificationMethods is only for desktop & browser.
* PM-5242 - User-verification-form-input - Adjust layout to meet new design requirements - (1) On load, send OTP without user clicking a button (2) Allow resending of the codes (3) show a code sent message for 3 seconds
* PM-5242 - Browser User Verification - Instantiate PinCryptoService and UserVerification service AFTER instantiating vaultTimeoutSettingsService so that it isn't undefined at run time.
* PM-5242 - JslibServices Module - UserVerificationService - add missing PlatformUtilsServiceAbstraction dependency.
* PM-5242 - Desktop Native Messaging Service - Wrap biometric getUserKeyFromStorage call in try catch because it throws an error if the user cancels the biometrics prompt and doesn't send a response to the browser extension when using the biometrics unlock bridge to the desktop app and OS.
* PM-5242 - Browser Extension - NativeMessagingBackground - if the desktop biometricUnlock command is executed with a canceled (not adjusting misspelling to keep side effects at a min) response, don't bother continuing.
* PM-5242 - BrowserCryptoService - When retrieving the user key via desktop biometrics, return null for user key if the user fails or cancels the biometrics prompt. Otherwise, if there is a user key in memory after unlock, biometrics user verification will always just return the user key from state regardless of if the user has successfully passed the biometrics prompt or not.
* PM-5242 - BrowserCryptoService - extra comments
* PM-5242 - Clean up translations - (1) Remove unused defaultUserVerificationDialogConfirmBtnText (2) Refactor name of defaultUserVerificationDialogTitle to just be verificationRequired which matches existing naming conventions.
* PM-5242 - CLI - fix order of service instantiations to ensure that vaultTimeoutSettingsService isn't undefined for PinCryptoService and UserVerificationService
* PM-5242 - Rename UserVerificationDialogParams to UserVerificationDialogOptions to match existing naming conventions of other CL comps.
* PM-5242 - UserVerificationDialogComponent - dialogParams renamed to dialogOptions
* PM-5242 - UserVerificationService Abstraction - Per PR feedback, use keyof for verificationType
* PM-5242 - UserVerificationBiometricsIcon - Per PR feedback, use https://jakearchibald.github.io/svgomg/ to optimize SVG by 50%.
* PM-5242 - Per PR feedback, clarify UserVerificationDialogOptions.clientSideOnlyVerification comment.
* PM-5242 - UserVerificationTypes - Add comments clarifying all text passed to the UserVerificationDialog are translation keys
* PM-5242 - UserVerificationDialogComp - fix extra new line per PR feedback
* PM-5242 - UserVerificationDialogTypes - per PR feedback and discussion with Will M., export ButtonType from CL so we (and consumers of the dialog) can properly import it via standard CL import.
* PM-5242 - BrowserCryptoService - Adjust comments per PR feedback.
* PM-5242 - UserVerificationDialogComponent - make ActiveClientVerificationOption readonly as it only for component html
* PM-5242 - UserVerificationDialogComp html - finish comment
* PM-5242 - BrowserCryptoService - add returns js doc per PR feedback.
* PM-5242 - UserVerificationDialogComponent - per PR feedback, add unexpected error toast.
* PM-5242 - UserVerificationService - getAvailableVerificationOptions - update params to use keyof like abstraction
* PM-5242 - Mark all existing client specific implemetations of user verification as deprecated.
* add flag to deter process reload if cancel is clicked on biometrics
* rename flag
* store biometrics cancelled to disk instead of integrating with process reload
* allow auto-prompt when opening app
* PM-4596 - PinCryptoService first draft
* PM-4596 - PinCryptoService - Refactor pinKeyEncryptedKey retrievals out into own method getPinKeyEncryptedKeys
* PM-4596 - npm ci + npm run prettier to fix lint issues
* PM-4596 - PinCryptoService - Add kdf types
* PM-4596 - PinCryptoService - Refactor pin validation into own helper method.
* PM-4596 - Rename pin-crypto.service.ts to pin-crypto.service.implementation.ts
* PM-4596 - PinCryptoService - add additional logging for error states.
* PM-4596 - JslibServicesModule - register new PinCryptoService and PinCryptoServiceAbstraction
* PM-4596 - PinCryptoService - modify decryptUserKeyWithPin signature to not require email to match MP verification process in user verification service.
* PM-4596 - Lock components - use new PinCryptoService.decryptUserKeyWithPin(...) to get user key + refactor base comp unlock with pin method to improve
* PM-4596 - Lock component - if too many invalid attempts, added toast explaining that we were logging the user out due to excess PIN entry attempts
* PM-4596 - UserVerificationService - (1) Refactor verifyUser(...) to use switch + separate methods for a cleaner parent method + better extensibility for PIN & biometrics which are TBD (2) Add PIN support to validateInput(...)
* PM-4596 - UserVerificationService - add PIN and biometrics functions to verifyUser(...)
* PM-4596 - PinCryptoService Spec - start test file - instantiates properly
* PM-4596 - PinCryptoService tests - WIP
* PM-4596 - PinCryptoService tests - WIP - got success cases working
* PM-4596 - pin-crypto.service.implementation.spec.ts renamed to pin-crypto.service.spec.ts
* PM-4596 - PinCryptoService.getPinKeyEncryptedKeys(...) - add comment + var name change for clarity
* PM-4596 - PinCryptoService tests - test invalid, null return scenarios
* PM-4596 - CLI - bw.ts - update UserVerificationService instantiation to include new pinCryptoService
* PM-4596 - PinCryptoService - import VaultTimeoutSettingsServiceAbstraction instead of implementation for factory creation to get browser building
* PM-4596 - (1) Create pinCryptoServiceFactory for browser background (2) Add it to the existing userVerificationServiceFactory
* PM-4596 - Browser - Main.background.ts - Add pinCryptoService and add to userVerificationService dependencies
* PM-4596 - UserVerificationService - per PR feedback simplify returns of verifyUserByPIN(...) and verifyUserByBiometrics(...)
* PM-4596 - Messages.json on desktop & browser - per PR feedback, adjust tooManyInvalidPinEntryAttemptsLoggingOut translation text to remove "you"
* PM-4596 - VerificationType enum - fix line copy mistake and give BIOMETRICS own, unique value.
* PM-4596 - VerificationType - rename BIOMETRICS to Biometrics to match existing MasterPassword value case.
* PM-4596 - Update verification type to consider whether or not a secret exists as we have added a new verification which doesn't have a type. Add new server and client side verification types. Update all relevant code to pass compilation checks.
* PM-4596 - More verification type tweaking
* PM-4596 - Verification - verificationHasSecret - tweak logic to be more dynamic and flexible for future verification types
* PM-4596 - UpdateTempPasswordComp - use new MasterPasswordVerification
* PM-4596 - Desktop - DeleteAcctComp - use VerificationWithSecret to solve compile error w/ accessing secret
* PM-4596 - Per discussions with Andreas & Will, move new Pin Crypto services into libs/auth + added @bitwarden/auth path to CLI tsconfig + added new, required index.ts files for exporting service abstractions & implementations
* PM-4596 - Fixed missed import fixes for lock components across clients for pin crypto service after moving into @bitwarden/auth
* PM-4596 - More PinCryptoService import fixes to get browser & desktop building
* PM-4596 - Update desktop lock comp tests to pass by providing new pin crypto service.
* PM-4596 - User verification service -update todo
* PM-4596 - PinCryptoService - per PR feedback, fix auto import wrong paths.
* PM-4596 - PinCryptoService tests - fix imports per PR feedback
* PM-4596 - UserVerificationSvc - rename method to validateSecretInput per PR feedback
* Fix imports
* PM-4596 - PinCryptoService - Refactor naming for clarity and move test cases into describes per PR feedback
* reorg libs/auth; expose only libs/auth/core to cli app
* PM-4596 - UserVerification - Resolve import issue with importing from libs/auth. Can't use @bitwarden/auth for whatever reason.
* PM-4596 - Fix desktop build by fixing import
* PM-4596 - Provide PinCryptoService to UserVerificationService
* PM-4596 - PinCryptoServiceFactory - you cannot import services from @bitwarden/auth in the background b/c it brings along the libs/auth/components and introduces angular into the background context which doesn't have access to angular which causes random test failures. So, we must separate out the core services just like the CLI to only bring along the angular agnostic services from core.
* PM-4596 - Refactor libs/auth to have angular / common + update all imports per discussion with Matt & Will. Introduced circular dep between PinCryptoService + VaultTimeoutSettingsService + UserVerificationService
* PM-4596 - VaultTimeoutSettingsService - Refactor UserVerificationService out of the service and update all service instantiations and tests. The use of the UserVerificationService.hasMasterPassword method no longer needs to be used for backwards compatibility. This resolves the circular dependency between the PinCryptoService, the UserVerificationService, and the VaultTimeoutSettingsService. We will likely refactor the hasMasterPassword method out of the UserVerificationService in the future.
* PM-4596 - Update CL tsconfig.libs.json to add new auth/common and auth/angular paths for jslib-services.module imports of pin crypto service to work and for test code coverage to run successfully.
* PM-4596 - Address PR feedback
* PM-4596 - Update root tsconfig (only used by storybook) to add new libs/auth paths to fix chromatic build pipeline.
* PM-4596 - Actually update tsconfig with proper routes to fix storybook
* PM-4596 - UserVerificationService - verifyUserByBiometrics - add error handling logic to convert failed or cancelled biometrics verification to a usable boolean
* PM-4596 - Add missing await
* PM-4596 - (1) Add log service and log to user verification service biometric flow to ensure errors are at least revealed to the console (2) Fix factory missing PinCryptoServiceInitOptions
* PM-4596 - Use the correct log service abstraction
* PM-4596 - Remove unused types per PR review
---------
Co-authored-by: William Martin <contact@willmartian.com>
* [deps] Tools: Update electron to v28.1.3
* Bump electron version in electron-builder.json
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.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>
* [deps] Tools: Update electron to v28.1.2
* Bump version in electron-builder.json
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* [PM-2417] convert modal to dialog service
* code format
* [PM-2417] Fix title
* [PM-2417] Remove unnecessary class
* Updated to use a local reference for the dialog.
* Changes to clarify the method naming
* More cleanup with Will.
* Removed unused style
---------
Co-authored-by: Todd Martin <tmartin@bitwarden.com>
Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>
Co-authored-by: Todd Martin <106564991+trmartin4@users.noreply.github.com>
* [deps] Tools: Update electron to v28.1.1
* Bump version in electron-builder.json
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* [deps] Tools: Update electron to v28
* Update electron-builder 27.2.0 to 28.1.0
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* PM-3859 - Desktop App Comp - Build lock mechanism for update app menu which doesn't try to update the menu for users who are being logged out which was causing errors (primary scenario was triggered by logging in on desktop with a TDE user w/out a MP, triggering a sync, then hitting the command to lock the vault right after which would trigger a log out while the sync was still in process. Then, while the log out was in process, the sync would try and trigger an update to the app menu but it would error as some of the user's state had already been cleaned up)
* PM-3859 - App comp - remove use of promise.all to prevent any race conditions from causing intermittent logout errors with state being cleared and then values trying to be set on the cleared state (I observed setMasterKey get called after state account.keys was cleared - received error when attempting to set value on undefined).
* PM-3859 - Desktop Vault Items Component - on log out, if you were on the vault screen, the loss of focus on the vault search text box would trigger a search 200 ms after log out had been triggered. This would eventually attempt to set an undefined master key (VaultItemsComponent.doSearch() --> cipherService.getAllDecrypted() --> cryptoService.getUserKeyWithLegacySupport() --> cryptoService.getMasterKey() --> cryptoService.setMasterKey()). However, at this point, the account had been cleared as part of the log out process and an error would be thrown in the state service for trying to set account.keys.masterKey to undefined when the account and account.keys were undefined. These changes prevent the search from firing until the value changes and also prevents setMasterKey from being called if it is undefined.
* migrate to DialogService
* use static method
* add reactive form dependencies
* begin migrating to reactive forms
* migrate template inputs to use CL
* update set-pin.component.ts file to work with reactive forms
* migrate desktop template and class file to Dialog and ReactiveForms
* update settings page
* remove old properties
* update settings form upon dialog close
* refactor ngOnInit()
* remove duplicate validator (already have a validator in class file)
* [deps] Tools: Update electron to v27.2.0
* Bump electronVersion to 27.2.0
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* [PM-4048] Use dialog service instead of modal service. Change UI file to use bit-Dialog. Remove from app module into standalone.
* [PM-4048] Update app.module imports
* [PM-4048] Fix form.
* PM-4048 - Delete Account tweak - remove unncessary delete header per discussion with product
* PM-4048 - Per CL migration guide,
* PM-4048 - (1) Remove button module import from dialog module exports (2) Add CL imports to desktop app module for delete acct dialog comp (3) Update delete acct dialog comp to use bitSubmit
* PM-4048 - Remove deprecated data-dismiss as bitDialogClose replaced it in terms of functionality.
* PM-4048 - Desktop Delete Acct - update loading button logic to latest CL standards (thanks Will!)
* PM-4048 - Must manually show errors to get "User Verification failed" message when user inputs incorrect MP.
* PM-4048 - desktop - delete-account.component.html - per PR feedback, remove non-tailwind classes and address missing bitFormButton
* PM-4048 - DeleteAccountComponent - per PR feedback, import DialogService using proper import alias.
* PM-4048 - delete-account.component.html - per PR feedback, remove no longer needed #form
* PM-4048 - delete-account.component.html - remove missed non-tailwind class
* PM-4048 - DeleteAccountComponent - per PR feedback, remove try catch as it is unnecessary as the bitSubmit handles errors
* add bespoke border to fix color contrast issue
* convert delete-account.component and user-verification.component to standalone; revert app module CL imports
* run prettier
* run prettier again
---------
Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>
Co-authored-by: Jared Snider <jsnider@bitwarden.com>
Co-authored-by: William Martin <contact@willmartian.com>
* Add light LinkType to link directive
* add skip link to bit-layout; update i18n for all apps
* install storybook interaction testing packages
* update storybook config
* add skiplink story to bit-layout
* update route and focus logic
* remove focus ring
* Use bitTypography for page title
* Replaced app-callout with bit-callout
* Replace button with bit-button
* Update radio buttons to use CL
* Use searchable select for fileFormat dropdown
* Remove unneeded divs (old styling)
* pm-1826 remove eslint-disable tailwindcss/no-custom-classname
* Removed for-attribute from bit-labels
* Removed bitInput from bit-selects
* Removed name-attribute from bit-selects
* Make format a required field
* Removed unused dependency on cryptoService
* Remove unused dependency on BroadcasterService
* Removed dependency on window
* Moved organizationId into BaseExportComponent
* Add vaultSelector
Add organizationService as new dependency
Retrieve organizations a user has access to
Add vaultSelector dropdown
Add `export from` label
Add exportFromHint
* Removed hint as discussed by product&design
* Add function to check for import/export permission
* Export callout should listen to changes
Even though the organizationId was changed, the Input did not trigger changing the scope
* Reading FlexibleCollections feature flag to show the vault-selector on export (#7196)
---------
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Co-authored-by: aj-rosado <109146700+aj-rosado@users.noreply.github.com>
* decompose password generator policy enforcement
* integrate new logic with UI
* improve UX of minimum password length
* improve password generator policy options documentation
* initialize min length to default minimum length boundary
* reset form value on input to prevent UI desync from model
---------
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
* Handle switch messaging
TODO: handle loading state for account switcher
* Async updates required for state
* Fallback to email for current account avatar
* Await un-awaited promises
* Remove unnecessary Prune
Prune was getting confused in browser and deleting memory in browser on
account switch. This method isn't needed since logout already removes
memory data, which is the condition for pruning
* Fix temp password in browser
* Use direct memory access until data is serializable
Safari uses a different message object extraction than firefox/chrome
and is removing `UInt8Array`s. Until all data passed into StorageService
is guaranteed serializable, we need to use direct access in state
service
* Reload badge and context menu on switch
* Gracefully switch account as they log out.
* Maintain location on account switch
* Remove unused state definitions
* Prefer null for state
undefined can be misinterpreted to indicate a value has not been set.
* Hack: structured clone in memory storage
We are currently getting dead objects on account switch due to updating
the object in the foreground state service. However, the storage service
is owned by the background. This structured clone hack ensures that all
objects stored in memory are owned by the appropriate context
* Null check nullable values
active account can be null, so we should include null safety in the
equality
* Correct background->foreground switch command
* Already providing background memory storage
* Handle connection and clipboard on switch account
* Prefer strict equal
* Ensure structuredClone is available to jsdom
This is a deficiency in jsdom --
https://github.com/jsdom/jsdom/issues/3363 -- structured clone is well
supported.
* Fixup types in faker class
* add avatar and simple navigation to header
* add options buttons
* add app-header to necessary pages
* add back button and adjust avatar sizes
* add helper text when account limit reached
* convert magic number to constant
* add clarifying comment
* adjust homepage header styles
* navigate to previousp page upon avatar click when already on '/account-switcher'
* move account UI to own component
* add i18n
* show correct auth status
* add aria-hidden to icons
* use listbox role
* add screen reader accessibility to account component
* more SR a11y updates to account component
* add hover and focus states to avatar
* refactor hover and focus states for avatar
* add screen reader text for avatar
* add slide-down animation on account switcher close
* remove comment
* setup account component story
* add all stories
* move navigation call to account component
* implement account lock
* add button hover effect
* implement account logout
* implement lockAll accounts functionality
* replace 'any' with custom type
* add account switcher button to /home login page
* use <main> tag (enables scrolling)
* change temp server filler name
* temporarily remove server arg from account story
* don't show avatar on /home if no accounts, and don't show 'lock'/'logout' buttons if no currentAccount
* add translation and a11y to /home avatar
* add correct server url to account component
* add 'server' to AccountOption type
* Enabled account switching client-side feature flag.
* add slide-in transition to /account-switcher page
* change capitalization to reflect figma design
* make screen reader read active account email, address more capitalization
* fix web avatar misalignment
* make avatar color based on user settings and in sync with other clients
* make property private
* change accountOptions to availableAccounts for clarity
* refactor to remove 'else' template ref
* remove empty scss rule
* use tailwind instead of scss
* rename isSelected to isActive
* add 'isButton' to /home page avatar
* move files to services folder
* update import
* Remove duplicate active account button
* Move no account button to current-account component
* Always complete logging out
Fixes PM-4866
* make screenreader read off email, not name
* refactor avatar for button case
* Do not next object updates
StateService's init was calling `updateState` at multiple layers,
once overall and then again for each account updated. Because
we were not maintaining a single state object through the
process, it was ending up in a consistent, but incomplete state.
Fixed by returning the updated state everywhere. This very well
may not be all the bugs associated with this
* Treat null switch account as no active user
* Listen for switchAccountFinish before routing (#6950)
* adjust avatar style when wrapped in a button
* show alt text for favicon setting
* move stories to browser
* Send Finish Message on null
* Dynamically set active user when locking all
This is required because some user lock states are not recoverable after
process reload (those with logout timeout). This waits until reload is
occurring, then sets the next user appropriately
* Move Finished Message to Finally Block
Fix tests
* Drop problematic key migration
Fixes PM-4933. This was an instance of foreground/background collision
when writing state. We have several other fallbacks of clearing
these deprecated keys.
* Prefer location to homebrew router service
* Initialize account disk cache from background
Uses the `isRecoveredSession` bool to re-initialize foreground caches
from a background message. This avoids a lengthy first-read for
foregrounds
* PM-4865 - Browser Acct Switcher - only show lock btn for lockable accounts (#6991)
* Lock of active account first, when locking multiple.
Fixes PM-4996
* Fix linter
* Hide lock now for locked users (#7020)
* Hide lock now for locked users
* Prefer disabling button to removing
* Add tooltip to TDE without unlock method
* Load all auth states on state init (#7027)
This is a temporary fix until the owning services can update state
themselves. It uses the presence of an auto key to surmise unlocked
state on init. This is safe since it's run only once on extension start.
* Ps/pm 5004/add load to account switcher (#7032)
* Add load spinner to account switcher
* Remove ul list icons
* Properly size account switcher in popout
* [PM-5005] Prevent Double Navigation (#7035)
* Delete Overriden Method
* Add Lock Transition
* truncate email and server name
* remove account.stories.ts (will add in separate PR)
* Do not switch user at reload if no user is active
* fix prettier issues
---------
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
Co-authored-by: Todd Martin <tmartin@bitwarden.com>
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>
Co-authored-by: bnagawiecki <107435978+bnagawiecki@users.noreply.github.com>
* Handle switch messaging
TODO: handle loading state for account switcher
* Async updates required for state
* Fallback to email for current account avatar
* Await un-awaited promises
* Remove unnecessary Prune
Prune was getting confused in browser and deleting memory in browser on
account switch. This method isn't needed since logout already removes
memory data, which is the condition for pruning
* Fix temp password in browser
* Use direct memory access until data is serializable
Safari uses a different message object extraction than firefox/chrome
and is removing `UInt8Array`s. Until all data passed into StorageService
is guaranteed serializable, we need to use direct access in state
service
* Reload badge and context menu on switch
* Gracefully switch account as they log out.
* Maintain location on account switch
* Remove unused state definitions
* Prefer null for state
undefined can be misinterpreted to indicate a value has not been set.
* Hack: structured clone in memory storage
We are currently getting dead objects on account switch due to updating
the object in the foreground state service. However, the storage service
is owned by the background. This structured clone hack ensures that all
objects stored in memory are owned by the appropriate context
* Null check nullable values
active account can be null, so we should include null safety in the
equality
* Correct background->foreground switch command
* Already providing background memory storage
* Handle connection and clipboard on switch account
* Prefer strict equal
* Ensure structuredClone is available to jsdom
This is a deficiency in jsdom --
https://github.com/jsdom/jsdom/issues/3363 -- structured clone is well
supported.
* Fixup types in faker class
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.
The latest version of types/node had some breaking changes related to Timer and Timeout, #6739. It turns out that we incorrectly used the type Timer when Timeout was expected in a few places. This PR resolves them, in an effort to unblock the @types/node upgrade.
We missed an await which caused the if statement to never be true. This might have had the effect of not showing a browser integration error message when attempting to unlock should biometrics for some reason be unavailable.
* PM-2041 - (1) Bring over WebauthnApiService + required models from existing #5493 PR (2) Per discussion with Andreas, remove unnecessary methods from WebauthnApiService
* PM-2041 - Rename responses folder to response to match rest of codebase
* PM-2041 - Recreate BaseLoginViaWebAuthnComponent and then web implementation of it.
* PM-2041 - Web routing module - add LoginViaWebAuthnComponent and associated route "login-with-passkey"
* PM-2041 - InjectionTokens - add new navigator credentials injection token which provides the CredentialsContainer interface of the Credential Management API and exposes methods to request credentials and notify the user agent when events such as successful sign in or sign out happen
* PM-2041 - Rename WebauthnApiService & abstraction to WebAuthnLoginApiService
* PM-2041 - Rename WebauthnLoginApiService to WebAuthnAdminApiService
* PM-2041 - Bring over first draft of webauthn-login.service + abstraction; register on jslib-services.module.
* PM-2041 - Bring over web & base login component changes to add login with passkey button if feature flag enabled.
* PM-2041 - WebAuthnAdminApi - update list of TODOs based on conversation with Andreas
* PM-2041 - Login.module - cleanup todo after conversation w/ Andreas
* PM-2041 - Move utils out of web and into common auth/utils and renamed to webauthn-utils
* PM-2041 - Update userDecryptionOptions to support new webauthn prf decryption option
* PM-2041 - (1) Recreate webauthn-login service with updated logic (2) Move files from webauthn to webauthn-login (3) Recreate webauthn-login.strategy with updated logic
* PM-2041 - Remove completed TODO
* PM-2041 - Fix login-via-webauthn component imports + fix name (missing n)
* PM-2041 - Missed this change when renaming LoginViaWebAuthComponent to LoginViaWebAuthnComponent
* PM-2041 - Add WebAuthnLoginApiService to jslib-services.module
* PM-2041 - Remove unused param from WebAuthnLoginApiServiceAbstraction as we aren't supporting non-discoverable passkeys for MVP
* PM-2041 - WebAuthnLoginApiService - remove email and target correct endpoint for getCredentialAssertionOptions(...) call
* PM-2041 - WebAuthnLoginStrategy - (1) Remove unused dep (2) Add safeguard checks to setUserKey(...) logic similar to SSO login strategy
* PM-2041 - BaseLoginViaWebAuthnComponent - Rewrite authenticate logic to use new methods on webAuthnLoginService
* PM-2041 - UserDecryptionOptionsResponse - update naming of webAuthn options object to match server response
* PM-2041 - WebAuthnLoginAssertionResponseRequest - (1) clean up TODO (2) Fix response property name to match server
* PM-2041 - WebAuthnTokenRequest - must stringify device response b/c sending as form data
* PM-2041 - AuthService - Add WebAuthnLoginCredentials and WebAuthnLoginStrategy support to auth service
* PM-2041 - WIP tests for WebAuthnLoginService
* PM-2041 - UserDecryptionOptions - Rename WebAuthnPrfOptions to singular WebAuthnPrfOption to match server
* PM-2041 - Add TODO in login comp
* PM-2041 - (1) Update WebAuthnLoginService.assertCredential(...) to add a check to ensure we cannot leak PRF credentials to the BW server by mistake (2) Add credential to view names for clarity (3) Add JS doc style comments to WebAuthnLoginServiceAbstraction
* PM-2041 - Login.component.html - (1) Center passkey login button (2) Use correct user passkey icon
* PM-2041 - Utils + tests - (1) Add new hexStringToArrayBuffer(...) method (2) Add tests for existing fromBufferToHex(...) (3) Add tests for new hexStringToArrayBuffer(...) method
* PM-2041 - Fix broken import
* PM-2041 - WebAuthnLoginResponseRequest - Adjust warning to be correct
* PM-2041 - Webauthn-utils - createSymmetricKeyFromPrf(...) - add return type
* PM-2041 - WebAuthnLoginService spec file - good progress on figuring out how to test passkey assertion process. Tests are passing, but need to add more setup logic around the MockAuthenticatorAssertionResponse in order to be able to confirm the output is correct.
* PM-2041 - Utils + Utils Spec file changes - (1) Add new fromB64ToArrayBuffer(...) method (2) Add tests for existing fromBufferToB64(...) (3) Add tests for new fromB64ToArrayBuffer(...) method (4) Add round trip conversion tests in both directions
* PM-2041 - Utils.spec - update round trip conversion tests between hex string and array buffer.
* PM-2041 - WebAuthnLoginService.spec - assertCredential(...) happy path test passing
* PM-2041 - WebAuthnLoginAssertionResponseRequest - Add interface
* PM-2041 - WebAuthnLoginAssertionResponseRequest data should be UrlB64 strings per discussion w/ Andreas
* PM-2041 - WebAuthnLoginService Spec file - Per feedback, reverse approaches to generating test data (go from array buffer to b64 strings vs the reverse) to avoid using math.random which can introduce test inconsistency
* PM-2041 - Finish testing assertCredential(...)
* PM-2041 - WebAuthnLoginService tests completed - tested logIn method
* PM-2041 - Login html - add "or" between standard email login and passkey login
* PM-2041 - WebAuthnLoginStrategy test start
* PM-2041 - After rebase - BaseLoginViaWebAuthnComponent - Must rename ForceResetPasswordReason to ForceSetPasswordReason + refactor post login routing logic to match other auth owned flows.
* PM-2401 - Desktop - login comp - fix desktop build
* PM-2041 - Browser - login comp - fix build issue
* PM-2401 - WIP on webauthn-login.strategy testing
* PM-2401 - Finish testing webauthn login strategy
* PM-2041 - WebAuthnAdminApiService renamed to WebAuthnLoginAdminApiService
* PM-2041 - Remove unnecessary comment
* PM-2041 - Per PR feedback, remove noMargin and just add mb-3
* PM-2041 - Per PR feedback, remove unused 2FA and remember email logic (2FA isn't supported right now and we aren't using non-discoverable credentials so we aren't using a user entered email)
* PM-2401 - BaseLoginViaWebAuthnComponent - improve error handling to allow users to retry w/ another passkey
* PM-2401 - Per PR feedback, provide translated message to cover all invalid passkey scenarios.
* PM-2401 - WebAuthnLoginService - per PR feedback, remove unnecessary from
* PM-2041 - WebAuthnLoginCredentialAssertionView - per PR feedback, use actual key type
* PM-2401 - Per PR feedback, remove WebAuthnLoginStrategy constructor as it is identical to its super class constructor
* PM-2041 - WebAuthnLoginService tests - use first value from to improve tests
* PM-2401 - Fix WebAuthnLoginService build issue after changing SymmetricCryptoKey to PrfKey
* PM-2041 - WebAuthnLoginServiceAbstraction remove incorrect undefined from getCredentialAssertionOptions() abstraction
* PM-2041 - Refacor WebAuthn login service tests based on PR feedback
* PM-2041 - Per PR feedback, remove NAVIGATOR_CREDENTIALS injection token and just use WINDOW directly for WebAuthnLoginService
* PM-2041 - WebAuthnLoginServiceAbstraction - per PR feedback, improve assertCredential jsdocs with return info
* PM-2041 - Per PR feedback, update WebAuthnLoginStrategy logInTwoFactor(...) to return an exception if attempted to be called.
* PM-2041 - WebAuthnLoginResponseRequest - per PR feedback, replace fromBufferToB64(...) with fromBufferToUrlB64(...)
* PM-2041 - AssertionOptionsResponse - use doc comment per PR feedback
* PM-2041 - Per PR feedback, adjust location of helpers and mocks in WebAuthnLoginStrategy test file
* PM-2041 - Adjust WebAuthnLoginService tests to take the WebAuthnLoginResponseRequest change to use fromBufferToUrlB64(...) into account to get tests to pass again
* PM-2041 - WebAuthnLoginStrategy - adjust test name to match convention per PR feedback
* PM-2041 - More test tweaks - (1) Rename method (2) Support strict
* PM-2041 - Per PR feedback, AssertionOptionsResponse constructor should null check allowCredentials b/c it is optional
* PM-2041 - Per PR Feedback, remove duplicated fromB64ToArrayBuffer(...) from utils and update tests.
* PM-2041 - Per PR feedback, rename WebAuthnTokenRequest to WebAuthnLoginTokenRequest
* PM-2041 - Per discussion with product and Andreas, add 2FA transition handling just in case we add server support in the future.
* feat: stretch PRF key (#6927)
* feat: stretch PRF key
includes necessary utils -> service refactors
* feat: add tests
* [PM-2041] feat: assertion-options `POST` -> `GET`
* [PM-2041] chore: remove unused properties
* [PM-2041] fix: set private key
* [PM-2041] feat: remove all 2FA related fields
* [PM-2041] chore: clean up 2FA comments
* [PM-2041] chore: document `webauthn-login-prf-crypto.service.abstraction.ts`
* [PM-2041] chore: document webauthn login services
---------
Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
Co-authored-by: Andreas Coroiu <andreas.coroiu@gmail.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
* 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 server url to account switcher tab
* add serverUrl to SwitcherAccount(s)
* refactor serverUrl getter
* cleanup urls
* adjust styling
* remove SwitcherAccount class
* remove authenticationStatus from AccountProfile
* rename to inactiveAccounts for clarity
* move business logic to environmentService
* use tokenService instead of stateService
* cleanup type and comments
* remove unused property
* replace magic strings
* remove unused function
* minor refactoring
* refactor to use environmentService insead of getServerConfig
* use Utils.getHost() instead of Utils.getDomain()
* create getHost() method
* remove comment
* get base url as fallback
* resolve eslint error
* Update apps/desktop/src/app/layout/account-switcher.component.html
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
---------
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>