* Specify state provider for currently active user
* Split active and single user States
UserStateProvider is still the mechanism to build each State object.
The SingleUserState is basically a repeat of GlobalState, but with
additional scoping.
* Fixup global state cache
* fix fakers to new interface
* Make userId available in single user state
* Split providers by dependency requirements
This allows usage of the single state provider in contexts that would
otherwise form circular dependencies.
* Offer convenience wrapper classes for common use
* Import for docs
* Bind wrapped methods
* 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
* Move Account Settings
* Add Another Test
* Refactor Tests
* Update Notification Bar to Get Value From Global
* Also Migrate Disable Context Menu
* Add Explanation
* 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>
* 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>
* 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>
* 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>
* 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
* [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>
* Move URI matching logic into uriView
* Fix url parsing: always assign default protocol, otherwise no protocol with port is parsed incorrectly
* Codescene: refactor domain matching logic
* Fix encrypted export using fixed PBKDF2 iterations
* Replace hardcoded KdfType in importer
* Clean up kdf handling in password-protected export
* Extract BitwardenPasswordProtectedFileFormat
* Rename bitwarden-json-types
* Move StateService import to fix linting issue
* Make linter happy
* Use abstraction instead of implementation
---------
Co-authored-by: Daniel James Smith <djsmith@web.de>
* Split out api methods into sendApiService
* Move SendService and abstraction
* Libs updates
* Web updates
* CLI updates
* Desktop updates
* libs send service fixes
* browser factory additions
* Browser updates
* Fix service injection for CLI SendReceiveCommand
* Deprecate directly calling send state service methods
* SendService observables updates
* Update components to use new observables
* Modify CLI to use state service instead of observables
* Remove unnecessary await on get()
* Move delete() to InternalSendService
* SendService unit tests
* Split fileUploadService by send and cipher
* send and cipher service factory updates
* Add file upload methods to get around circular dependency issues
* Move api methods from sendService to sendApiService
* Update cipherService to use fileApi methods
* libs service injection and component changes
* browser service injection and component changes
* Desktop component changes
* Web component changes
* cipher service test fix
* Fix file capitalization
* CLI service import and command updates
* Remove extra abstract fileUploadService
* WIP: Condense callbacks for file upload
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
* Send callbacks for file upload
* Fix circular service dependencies
* Fix response return on upload
* Fix function definitions
* Service injection fixes and bug fixes
* Fix folder casing
* Service injection cleanup
* Remove deleted file from capital letters whitelist
* Create new SendApiService for popup
* Move cipherFileUploadService to vault
* Move SendFileUploadService methods into SendApiService
* Rename methods to remove 'WithServer'
* Properly subscribe to sendViews
* Fix Send serialization
* Implement fromJSON on sendFile and sendText
* [PM-1347] Fix send key serialization (#4989)
* Properly serialize key on send fromJSON
* Remove call that nulled out decrypted sends
* Fix null checks in fromJSON methods for models
* lint fixes
---------
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
* Create and register new libs/importer
Create package.json
Create tsconfig
Create jest.config
Extend shared and root tsconfig and jest.configs
Register with eslint
* Move importer-related files to libs/importer
* Move importer-spec-related files to libs/importer
Move import.service.spec
* Update package-lock.json
* Set CODEOWNERS for new libs/importer
* Register libs/importer with cli and fix imports
* Register libs/importer with web and fix imports
* Move importOption into models
Rename importOptions to import-options
* Fix linting issues after updating prettier
* Only expose necessary files from libs/importer
Fix tsconfig files
- Removes the trailing /index on imports in web/cli
As the spec-files no longer can access the internals via @bitwarden/importer they import by path (../src/importers)
* Add barrel files to vendors with more than one importer
In Bitwarden, subfolders are separated/indicated using forward-slashes
The Keeper CSV export separates folders uses backslashes
Replace backslashes with forwardslashes in processFolder
Added tests to verfiy folder/collection creation
* Feature/SG-680 - Create Domain Verification Comp (#4283)
* domain-base.ts - added link to Architectural docs describing domain base class purpose
* SG-680 - (1) Created Org Domain API and observable based data store service (2) Created required response and request models
* SG-680 - Renaming org domain service abstractions to match existing convention
* SG-680 - (1) Updated getByOrgId method to return array of data to match back end + renamed it as such (2) Updated OrgDomainApiService get methods to update the OrgDomainService observables
* Two-factor-setup comp - change "tabbed-header" class to "page-header" to achieve visual consistency with other settings components.
* SG-680 - Refactor Org Domain API & domain services to conform to ADR 0013 - Avoid layered folder structure for request/response models (i.e., put models near "owner" services)
* SG-680 - Update Organization model to include a canManageDomainVerification check
* SG-680 - Created Domain Verification component and started scaffolding out HTML
* SG-680 - New OrgDomain state and API services need to be registered on jslib-services.module in order to be injectable into components for use (this is what maps abstractions to implementation for dependency injection)
* SG-680 - OrgDomainApiServiceAbstraction should be an abstract class
* SG-680 - Update OrgDomainApiService to use ListResponse and map into OrganizationDomainResponse properly
* SG-680 - Moved domain verification comp into subfolder to add clarity in folder structure
* SG-680 - Good start on Domain Add Edit Dialog
* SG-680 - Domain Add Edit Dialog - (1) Random generation of DNS TXT Record now working (2) DNS TXT Record Copyable (3) Additional translations added (4) Info callout added
* SG-680 - Domain Add Edit Dialog - (1) Added custom validator for domain name (2) Disable verify btn if form invalid
* SG-680 - Updated Domain Name custom validator to pass back error message in format the error.component.ts expected so it can be displayed without an untranslated error prefix of "invalidDomainName"
* Form-button - Added useful note regarding use of the bitFormButton directive and how it requires the use of the bitButton directive as well.
* SG-680 - OrgDomain.service - replace delete with splice as delete doesn't actually alter array. Duh.
* SG-680 - Domain verification progress - (1) Table layout + loading working for the most part (more translations needed (2) Add & edit opening dialog (3) Dialog first draft of save and verify
* SG-680 - DomainAddEditDialog - Unique domain name enforcement implemented
* SG-680 - Domain Name Custom Reactive forms validator refactor - swapped to regex to support proper domain format (which now enforces the requirement of a .com or similar)
* SG-680 - OrgDomainApi svc - must await send of delete call otherwise runs synchronously. Duh.
* SG-680 - Domain verification progress - (1) CopyDnsTxt added to state service (2) Refactored dialog to use async actions (3) Dialog form changes now mark form controls as touched for more responsive error handling
* SG-680 - Domain-add-edit-dialog - Confirmation required now for domain deletion
* SG-680 - Domain verification table options now supports removing domains with confirmation prompt
* Shared module - merge conflict resolution + removing unused imports so I can check this in.
* SG-680 - Adding missing translations
* SG-680 - Comment clean up + todo
* Revert "Shared module - merge conflict resolution + removing unused imports so I can check this in."
This reverts commit 98fe346e67.
* SG-680 - DomainAddEditDialog - Replace bitAction with leveraging bitSubmit so that when users hit enter in a field the form gets submitted.
* SG-680 - Added httpStatusCode enum
* SG-680 - OrgDomainAPI - Verify endpoint now returns domain response model so upsert to sync obs state service
* SG-680 - Domain Verification comp - (1) Display last checked date (2) Verify first attempt in place (3) justify options content per design
* SG-680 - DomainAddEditDialog - Validation and error handling overhaul
* SG-680 - DomainAddEditDialog - (1) Autofocus domain name on new domain creation (2) Removed form.invalid == form disabled logic because of accessibility concerns
* SG-680 - OrgDomainResponse model refactor - back end is sending lower cased props
* SG-680 - OrgDomain service refactor - (1) Use proper abstraction for i18n svc (2) Don't make non-async methods async for no reason
* SG-680 - OrgDomainService - Added test suite
* SG-680 - Renaming httpStatusCode.enum to strip off .enum in attempt to pass eslint issue
* SG-680 - Renaming httpStatusCode enum file again to remove all capitalized letters to pass eslint rules.
* SG-680 - Updating HttpStatusCode import b/c auto import update missed it.
* SG-680 - DomainAddEditDialog - Don't show callout if domain is verified
* SG-680 - DomainVerificationComp - Add error handling to verify to handle case where domain isn't available
* SG-680 - OrgDomainApiSvc - svc should use abstractions in constructor
* SG-680 - OrgDomainApiSvc - added full test suite
* SG-680 - OrgDomainSvc test suite - fixing broken test
* SG-680 - Domain Verification Validation Scenario: show form control error when domain verification fails - (1) Enhanced bitSubmit to optionally allowDisabledFormSubmit (2) Enhanced bitInput to optionally allow showErrorsWhenDisabled + added new docs
* SG-680 - Adjusting location & name of the bitInput docs to be in the top level docs section to match historical consensus and existing pattern.
* SG-680 - Removed TODO for adding tests since I've already added tests.
* SG-680 - DomainAddEditDialog - Handle verify domain conflict exceptions just in case
* SG-680 - Adjusting location of Domain verification settings item in the organization settings menu to match figma.
* SG-680 - Removing unnecessary comment
* SG-680 - Domain Verification component - updated svg to not have alt text so it is treated as decorative by screen readers for accessibility.
* SG-680 - Fixing messages.json missing }
* SG-680 - DomainAddEditDialog - Hardcoding inputs to bit-dialog as component vars are not needed for dynamic anything right now.
* SG-680 - Dialog comment refactor
* SG-680 - OrgDomainSvc - comment and console log removals.
* SG-680 - Updating OrgDomain Service test suites to have better test titles.
* Defect/web org domain claiming bugfixes (#4458)
* SG-949 - OrgDomainVerification - Domain name validator now supports n levels of subdomains as well as top level domains.
* SG-955 - On domain verification error or failure, call to update the individual org domain item to get an updated last checked date on the client.
* SG-953 - In domain verification dialog edit, if verify called and failed, then must manually mark domain name as touched for errors to show up.
* SG-954 - Domain Verification edit dialog - Fixing delete button not having trash icon displayed + added i18n translation for title prop.
* SG-956 - Fixing domain claiming event logs so that they show up on the client (more to do as there are some events missing client & member)
* Form button directive comment update
* SG-977 - Event Log improvements: (1) Add new device type of server (2) Add EventSystemUser mapping to translated value. The end result is that both SCIM and Domain verification logs properly show server as the client and SCIM or Domain verification as the member.
* Add comment to clarify use of SCIM in EVENT_SYSTEM_USER_TO_TRANSLATION dict
* DeviceType.Server must be incremented to 22 b/c server master already has a DeviceType.SDK of 21.
* Add SDK w/ value of 21 to DeviceType to match master server
* Defect/web org domain claiming bugfixes the sequel (#4530)
* Update <bit-table> to latest standard so it works again (swap body from ng-container to ng-template)
* Input directive - showErrorsWhenDisabled case doesn't need to care if input isActive or not.
* SG-949 - Update domain name validator regex to prevent http://, https://, and www.
* SG-771 - Added claimed domain logic to web client (#4603)
* SG-771 / SG-772 / SG-743 - Add claimed domain logic which skips entry of Org SSO Id when an org has a claimed and verified domain to web, browser, and desktop.
* Fix lint errors by adding button types
---------
Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
* Move auth service factories to Auth team
* Move authentication componenets to Auth team
* Move auth guard services to Auth team
* Move Duo content script to Auth team
* Move auth CLI commands to Auth team
* Move Desktop Account components to Auth Team
* Move Desktop guards to Auth team
* Move two-factor provider images to Auth team
* Move web Accounts components to Auth Team
* Move web settings components to Auth Team
* Move web two factor images to Auth Team
* Fix missed import changes for Auth Team
* Fix Linting errors
* Fix missed CLI imports
* Fix missed Desktop imports
* Revert images move
* Fix missed imports in Web
* Move angular lib components to Auth Team
* Move angular auth guards to Auth team
* Move strategy specs to Auth team
* Update .eslintignore for new paths
* Move lib common abstractions to Auth team
* Move services to Auth team
* Move common lib enums to Auth team
* Move webauthn iframe to Auth team
* Move lib common domain models to Auth team
* Move common lib requests to Auth team
* Move response models to Auth team
* Clean up whitelist
* Move bit web components to Auth team
* Move SSO and SCIM files to Auth team
* Revert move SCIM to Auth team
SCIM belongs to Admin Console team
* Move captcha to Auth team
* Move key connector to Auth team
* Move emergency access to auth team
* Delete extra file
* linter fixes
* Move kdf config to auth team
* Fix whitelist
* Fix duo autoformat
* Complete two factor provider request move
* Fix whitelist names
* Fix login capitalization
* Revert hint dependency reordering
* Revert hint dependency reordering
* Revert hint component
This components is being picked up as a move between clients
* Move web hint component to Auth team
* Move new files to auth team
* Fix desktop build
* Fix browser build
* Extract import methods from ApiService
Removed methods from ApiService impl and abstraction
Create import-api.service impl and abstraction
Moved import.service into abstractions/import/import.service.abstraction
Moved import.service into services/import/import.service
Change imports to use new services
* Fix import for tests
* Fix imports for CLI
* Fix imports for web
* Fix ModuleImports and dependencies
* Mark ImportApiService methods as async
* Add psono json importer
Create types for psono export format
Add test files
Write tests for psono-json-importer
Write importer for psono export
Register 'psonojson' with `importOptions`
Import/register psono-json-importer with import.service
Add instructions on how to export from Psono
* Retain all imported data
Ensure all data is retained by adding unmapped properties into custom fields
Each item type has a set of mapped properties, anything not matching will be created as a custom field
Write extensive tests to ensure data is present
* Skipping GPG
We currently cannot import GPG Keys into notes or custom fields
* Add organizational test
Verify that folders get converted to collections when imported by an org
* Remove combined test-file (whole export)
* Remove redundant null type
* [EC-639] Replacing single quote char for email values in Policies API request
* [EC-639] Added Utils.encodeRFC3986URIComponent and used in PolicyApiService and TwoFactorAuthenticatorComponent
* [EC-639] Added unit tests for Utils.encodeRFC3986URIComponent
* Move and rename importers ater new naming convention
Create a subfolder to hold all enpass-importers
Change names to new naming convention
Fix imports
Remove entries from whitelist
* Added types for exported enpass json file
* Add unit tests to verify for current behaviour
* Prefer types over enums
* Replace `any` types with defined Enpass types
* Add support for parsing Android urls
Fixes#2831
Added test-file with several combinations
Wrote test cases to verify
* Fixing queryselector since the existing is failing
* Add the unit test for the keepass fix
* Adding additional test for the query.selector fix
* Fixing a lint error message
* Keeper CSV import: import TOTP to correct field
* Fix small issue with notes import
Notes field can be null, the ` + "\n"` coerces those to `"null"`.
* Adds unit tests
* Fix migration logic to create keypair for old account
* Rename onSuccessfulLogin to reflect usage
* Rewrite loginStrategy spec with jest-mock-ex
* Rewrite tests with jest-mock-extended
* Assert call order
* Fix linting
* Move FsecureFskImporter into separate folder
* Add types for exported fsk file
* Add new testdata and rewrite existing tests
* Fix#2801 - Use type instead of style property to differentiate between cipher types
* Add setting cipher.favorite
* Remove unmapped property autofillAndroid
* Re-naming files due to new naming convention
Renamed added or changed files of this PR
Fixed all imports
Removed items from the whitelist
* Extract method refactor
Move logic inside of parse loop into parseEntry
Extract handling of Entries of type Login into handleLoginEntry
Extract handling of Entries of type CreditCard into handleCreditCardEntry
* Simplify folder structure
Use vendor name importer folder
Rename /importers/fsecureImporters to /importers/fsecure
Move fsecure-fsk-types.ts out of the types folder into the fsecure-folder
Delete types folder
Fix all the imports
* Move spec and test-data to fsecure importer
* Fix broken import after merge master
* Use the new FSecureFskImporter
Must have messed up during the last merge:
Delete old importer and spec
Fix import of FSecureFskImporter in import.service
Create types for passky export format
Add test files
Write tests for passky-json-importer
Write importer for passky export
Register 'passkyjson' with `importOptions`
Import/register passky-json-importer with import.service
Add instructions on how to export from Passky
* Replace the FolderView from Observable with getAllDecryptedFromState
* Fixing failed test
* Fixing the PR comment on addressing getEncryptedExport
* Fixing the failing test cases
* Adding some unit test to check folder is exported
* Fixing a failing test
* Rename to getAllFromState to conform
* Please rename to getAllFromState to conform test
Co-authored-by: dynwee <onwudiweokeke@gmail.com>
* Elevate Map <-> Record JSON helpers to Utils
* Build Account from a StateService provided AccountDeserializer
* Allow Manifest V2 usage of session sync
Expands use of SessionSyncer to all Subject types. Correctly handles
replay buffer for each type to ignore the flood of data upon
subscription to each Subject type.
* Create browser-synced Policy Service
* Move BrowserFolderService
* Libs account serialization improvements
* Serialize Browser Accounts
* Separate StateService in background/visualizations
Visualizer state services share storages with background page, which
nicely emulates mv3 synchronization through session/local storage. There
should not be multithreading issues since all of these services are
still running through a single thread, we just now have multiple places
we are reading/writing data from.
Smaller improvements
* Rename browser's state service to BrowserStateService
* Remove unused WithPrototype decorator :celebrate:
* Removed conversion on withPrototypeForArrayMembers. It's reasonable to
think that if the type is maintained, it doesn't need conversion.
Eventually, we should be able to remove the withPrototypeForArrayMembers
decorator as well, but that will require a bit more work on
(de)serialization of the Accounts.data property.
* Make Record <-> Map idempotent
Should we get in a situation where we _think_ an object has been
jsonified, but hasn't been, we need to correctly deal with the object
received to create our target.
* Check all requirements while duck typing
* Name client services after the client
* Use union type to limit initialize options
* Fixup usages of `initializeAs`
* Add OrganizationService to synced services
Co-Authored-By: Daniel James Smith <djsmith85@users.noreply.github.com>
* Add Settings service to synced services
Co-Authored-By: Daniel James Smith <djsmith85@users.noreply.github.com>
* Add missing BrowserStateService
* Fix factories to use browser-specific service overides
* Fix org-service registration in services.module
* Revert "Add missing BrowserStateService"
This reverts commit 81cf384e87.
* Fix session syncer tests
* Fix synced item metadata tests
* Early return null json objects
* Prefer abstract service dependencies
* Prefer minimal browser service overrides
* [SG-632] - Change forwarded providers radio buttons list to dropdown (#4045)
* SG-632 - Changed forwarded providers list of radio buttons to dropdown
* SG-632 - Added role attributes to improve accessibility.
* SG-632 - Added sorting to array and empty option
* SG-632 - Fix styling to match standards.
* rename cipehrs component to vault items component (#4081)
* Update the version hash for the QA Web build artifact to follow SemVer syntax (#4102)
* Remove extra call to toJSON() (#4101)
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Co-authored-by: Daniel James Smith <djsmith@web.de>
Co-authored-by: Carlos Gonçalves <carlosmaccam@gmail.com>
Co-authored-by: Jake Fink <jfink@bitwarden.com>
Co-authored-by: Joseph Flinn <58369717+joseph-flinn@users.noreply.github.com>
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
* Move OrganizationService to fullSync
* Add Tech Debt Tracking Link
* Remove Commented out code
* Add InternalOrganizationService
* Use InternalOrganization in services that get to update state
* Add fix for bw login with apikey argument fails bug
* Changes after running the prettier
* Revert chnages on the launch.json file
* Changes after running a lint
* Renaming a filename to remove capital letters
* Resolving the error on test run
* Renaming file names due lint errors
* Renaming new files to conform to snake case
* Remove the test for user api login strategy
* Adding the user api login test and file renaming
* Rename file name to organization-api-login.spec.ts
* Fixing the lint error on PR
* Adding the apiLogIn.strategy to whitelist-capital-letters
* Removing all the apiLogIn.strategy in whitelist-capital-letters.
* Fixing PR comment relating OrganizationApiTokenRequest
* Resolve PR comment on OrganizationApiTokenRequest model
* Fixing PR comment of separating organization token model
* fixing the lint error message
* Fixing the lint error
* Reverting the changes on lunch.js
* revert the actual content on launch.json
* Reverting changes relating to organization api login
* Removing the OrganizationIdentityTokenResponse file
* Removing OrganizationIdentityTokenResponse file
Co-authored-by: dynwee <onwudiweokeke@gmail.com>
* Rename all importer related files
Renamed all files based on our naming convention which we decided on with https://github.com/bitwarden/adr/blob/master/decisions/0012-angular-filename-convention.md
* Removed entries from whitelist-capital-letters.txt
* Rename missing safeInCloud test data
* Fix broken import
* Renamed folders (removed capital letters)
* Fix filename of BitwardenCsvImporter
* Fix imports of onepassword mac/win importer tests
* Remove already renamed folders from whitelist
* Rename dashlaneImporters to dashlane
Rename the folder
Fix all the imports
Remove dashlaneImporters from white-list
* Rename keeperImporters to keeper
Rename the folder
Fix all the imports
Remove keeperImporters from white-list
* Rename onepasswordImporters to onepassword
Rename the folder
Fix all the imports
Remove onepasswordImporters from white-list
* Rename safeinCloud test data folder
* Fix onepassword importer type imports
* Add item decryption to encryptService
* Create multithreadEncryptService subclass to handle web workers
* Create encryption web worker
* Refactor cipherService to use new interface
* Update dependencies
* [EC-417] Extracting the app name from the Android user item on CSV import
* [EC-417] Updated android csv pattern to match starting with 'android://'
* [EC-417] Added unit tests for ChromeCsvImporter
* Add test cases from previous PR https://github.com/bitwarden/jslib/pull/547
* Install tldts as replacement for tldjs
* Use tldts for hostname and domain retrieval/validation
* Remove usage of old tldjs.noop-implementation
* Add handling of about protocol
* Remove usage of tldEndingRegex and use tldts check instead
* Uninstall @types/tldjs and tldjs
* Updated package-lock.json
* Fix accessibility cookie check
* Rename loginUriView.spec to login-uri-view.spec
* Add test for getDomain failing file links
* getHostName - Return null when given, data, about or file links
* Add CreationDate to common libs
* Add CreationDate to Browser
* Add CreationDate to CLI
* Add CreationDate to Desktop
* Add CreationDate to Web
* Update tests
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
* Added abstractions for PolicyApiService and PolicyService
* Added implementations for PolicyApiService and PolicyService
* Updated all references to new PolicyApiService and PolicyService
* Deleted old PolicyService abstraction and implementation
* Fixed CLI import path for policy.service
* Fixed main.background.ts policyApiService dependency for policyService
* Ran prettier
* Updated policy-api.service with the correct imports
* [EC-377] Removed methods from StateService that read policies
* [EC-377] Updated policy service getAll method to use observable collection
* [EC-377] Added first unit tests for policy service
* [EC-377] Added more unit tests for Policy Service
* [EC-376] Sorted methods order in PolicyApiService
* [EC-376] Removed unused clearCache method from PolicyService
* [EC-376] Added upsert method to PolicyService
* [EC-376] PolicyApiService putPolicy method now upserts data to PolicyService
* [EC-377] Removed tests for deleted clearCache method
* [EC-377] Added unit test for PolicyService.upsert
* [EC-377] Updated references to state service observables
* [EC-377] Removed getAll method from PolicyService and refactored components to use observable collection
* [EC-377] Updated components to use concatMap instead of async subscribe
* [EC-377] Removed getPolicyForOrganization from policyApiService
* [EC-377] Updated policyAppliesToUser to return observable collection
* [EC-377] Changed policyService.policyAppliesToUser to return observable
* [EC-377] Fixed browser settings.component.ts getting vault timeout
* Updated people.component.ts to get ResetPassword policy through a subscription
* [EC-377] Changed passwordGenerationService.getOptions to return observable
* [EC-377] Fixed CLI generate.command.ts getting enforcePasswordGeneratorPoliciesOnOptions
* [EC-377] Fixed eslint errors on rxjs
* [EC-377] Reverted changes on passwordGeneration.service and vaultTimeout.service
* [EC-377] Removed eslint disable on web/vault/add-edit-component
* [EC-377] Changed AccountData.policies to TemporaryDataEncryption
* [EC-377] Updated import.component to be reactive to policyAppliesToUser$
* [EC-377] Updated importBlockedByPolicy$
* [EC-377] Fixed missing rename
* [EC-377] Updated policyService.masterPasswordPolicyOptions to return observable
* [EC-377] Fixed vaultTimeout imports from merge
* [EC-377] Reverted call to passwordGenerationService.getOptions
* [EC-377] Reverted call to enforcePasswordGeneratorPoliciesOnOptions
* [EC-377] Removed unneeded ngOnDestroy
* Apply suggestions from code review
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
* [EC-377] Fixed login.component.ts and register.component.ts
* [EC-377] Updated PolicyService to update vaultTimeout
* [EC-377] Updated PolicyService dependencies
* [EC-377] Renamed policyAppliesToUser to policyAppliesToActiveUser
* [EC-377] VaultTimeoutSettings service now gets the vault timeout directly instead of using observables
* [EC-377] Fixed unit tests by removing unneeded vaultTimeoutSettingsService
* [EC-377] Set getDecryptedPolicies and setDecryptedPolicies as deprecated
* [EC-377] Set PolicyService.getAll as deprecated and updated to use prototype.hasOwnProperty
* [EC-565] Reverted unintended change to vaultTimeoutSettings that was causing a bug to not display the correct vault timeout
* [EC-377] Removed unneeded destroy$ from preferences.component.ts
* [EC-377] Fixed policy.service.ts import of OrganizationService
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
Co-authored-by: mimartin12 <77340197+mimartin12@users.noreply.github.com>
* Update imports
* Implement observables in a few places
* Add tests
* Get all clients working
* Use _destroy
* Address PR feedback
* Address PR feedback
* Address feedback
* Clean up dangling behaviorSubject
* Handle null in utils
* fix null check
* Await promises, even in async functions
* Add to/fromJSON methods to State and Accounts
This is needed since all storage in manifest v3 is key-value-pair-based
and session storage of most data is actually serialized into an
encrypted string.
* Simplify AccountKeys json parsing
* Fix account key (de)serialization
* Remove unused DecodedToken state
* Correct filename typo
* Simplify keys `toJSON` tests
* Explain AccountKeys `toJSON` return type
* Remove unnecessary `any`s
* Remove unique ArrayBuffer serialization
* Initialize items in MemoryStorageService
* Revert "Fix account key (de)serialization"
This reverts commit b1dffb5c2c, which was breaking serializations
* Move fromJSON to owning object
* Add DeepJsonify type
* Use Records for storage
* Add new Account Settings to serialized data
* Fix failing serialization tests
* Extract complex type conversion to helper methods
* Remove unnecessary decorator
* Return null from json deserializers
* Remove unnecessary decorators
* Remove obsolete test
* Use type-fest `Jsonify` formatting rules for external library
* Update jsonify comment
Co-authored-by: @eliykat
* Remove erroneous comment
* Fix unintended deep-jsonify changes
* Fix prettierignore
* Fix formatting of deep-jsonify.ts
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
* [EC-381] Deleted unused method clearCache from Settings Service
* [EC-381] Marked settings methods as obsolete on State service
* [EC-381] Using observables on settings service
* [EC-381] Added unit tests for Settings service
* [EC-381] Checking userId on clear
* [EC-381] Updated references to StateService activeAccountUnlocked$
* [EC-381] Updated getEquivalentDomains to return observable
* [EC-381] Updated settings service to user concatMap on activeAccountUnlocked$
* [EC-381] Renamed getEquivalentDomains to equivalentDomains
* [EC-381] Completing Behaviors on settings.service tests
* [EC-381] Removed unused settingsPrefix from settings service
* [EC-381] Removed equivalentDomains from settings service and added type AccountSettingsSettings
* [EC-381] Updated settings service settings$ to not be nullable
* [EC-381] Settings default to {}
* Remove cast to any as Utils.gobal got typed with #3131
* BitwardenFileUploadService: Remove unneeded dependency
* Remove allowSoftLock from vaultTimeoutService
* ImportService: Remove dependency on PlatformUtilsSvc
* Create sessions sync structure
* Add observing to session-syncer
* Do not run syncer logic in decorator tests
* Extract test constants
* Change Observables to BehaviorSubject
* Move sendMessage to static method in BrowserApi
* Implement session sync
* only watch in manifest v3
* Use session sync on folder service
* Add array observable sync
* Bypass cache on update from message
* Create feature and dev flags for browser
* Protect development-only methods with decorator
* Improve todo comments for long-term residency
* Use class properties in init
* Do not reuse mocks
* Use json (de)serialization patterns
* Fix failing session storage in dev environment
* Split up complex EncString constructor
* Default false for decrypted session storage
* Try removing hydrate EncString method
* PR review
* PR test review
* Create base jest.config file
* Fix various tests that were broken
* Add maxWorkers to jest config
* Undo change to testEnvironment
* Enable tsconfig.spec.json
* Work on background service worker.
* Work on shortcuts
* Work on supporting service worker
* Put new background behind version check
* Fix build
* Use new storage service
* create commands from crypto service (#2995)
* Work on service worker autofill
* Got basic autofill working
* Final touches
* Work on tests
* Revert some changes
* Add modifications
* Remove unused ciphers for now
* Cleanup
* Address PR feedback
* Update lock file
* Update noop service
* Add chrome type
* Handle "/" in branch names
Updates web workflow to handle the `/` in branch names when it's a PR.
* Remove any
Co-authored-by: Jake Fink <jfink@bitwarden.com>
Co-authored-by: Micaiah Martin <77340197+mimartin12@users.noreply.github.com>
* Change subscription to rely on observables and not on BehaviourSubject
* Ensure OnDestroy is added to AppComponent
* Fix check for no active accounts to redirect to the login page instead of lock
* Change subscription handling on SearchBarService
* Fix naming convention: Observables should have a $ suffix
* Remove obsolete linter hint
* Fix activeAccountUnlocked getting exposed as Observable but is instantiated as BehaviourSubject
* Removed check for getBiometricLocked
It always returned false even when no biometrics were used.
* Remove the other check for getBiometricsLocked
* Ensure that biometricFingerprintValidation is reset, when biometrics are disabled
* Removed getBiometricsLocked and setBiometricsLocked
With nothing in the codebase reading the state of getBiometricsLocked, I've removed all places where it was set or saved.
* Refactor execution of reload into a separate method
* Conditonally pass the window object to `BrowserApi.reloadExtension`
* Clarify in comment, that the PIN has to be set with ask for Master Password on restart
* Ensure the process reload is executed on logout
* Use accounts instead of lastActive == null to determine a reload on logout
* Moved identical logic from desktop and browser into system.service
* Simplified check for refresh to handle no accounts found, logout, lock with lastActive longer than 5 seconds
* Move resolveLegacyKey to encryptService for utf8 decryption
* Deprecate account.keys.legacyEtmKey
Includes migration to tidy up leftover data
* Use new IEncrypted interface
* Use abstract methods and generics in StorageService
* Prepend `Abstract` to abstract classes
* Create session browser storage service
* Use memory storage service for state memory
* Inject memory storage service
* Maintain filename extensions to help ide formatting
* Preserve state if it's still in memory
* Use jslib's memory storage service
* linter
* Create prototypes on stored objects
* standardize package scripts
* Add type safety to `withPrototype` decorators
* webpack notify manifest version
* Fix desktop
* linter
* Fix script
* Improve prototye application
* do not change prototype if it already matches desired
* fix error with object values prototype application
* Handle null state
* Apply prototypes to browser-specific state
* Add angular language server to recommended extensions
* Improve browser state service tests
* Start testing state Service
* Fix abstract returns
* Move test setup files to not be picked up by default glob matchers
* Add key generation service
* Add low-dependency encrypt service
* Back crypto service with encrypt service.
We'll want to work items that don't require state over to encrypt service
* Add new storage service and tests
* Properly init more stored values
* Fix reload issues when state service is recovering state from session storage
Co-authored-by: Thomas Avery <Thomas-Avery@users.noreply.github.com>
Co-authored-by: Justin Baur <admin@justinbaur.com>
* Simplify encrypt service
* Do not log mac failures for local-backed session storage
* `content` changed to `main` in #2245
* Fix CLI
* Remove loggin
* PR feedback
* Merge remote-tracking branch 'origin/master' into add-memory-storage-to-state-service
* Fix desktop
* Fix decrypt method signature
* Minify if not development
* Key is required
Co-authored-by: Thomas Avery <Thomas-Avery@users.noreply.github.com>
Co-authored-by: Justin Baur <admin@justinbaur.com>