2020-03-09 17:06:38 +01:00
|
|
|
import * as fs from "fs";
|
2018-05-31 15:08:54 +02:00
|
|
|
import * as path from "path";
|
2021-12-20 18:04:00 +01:00
|
|
|
|
2022-03-03 18:24:41 +01:00
|
|
|
import * as program from "commander";
|
|
|
|
import * as jsdom from "jsdom";
|
|
|
|
|
2022-12-19 19:56:16 +01:00
|
|
|
import { OrganizationUserService } from "@bitwarden/common/abstractions/organization-user/organization-user.service";
|
[AC-1011] Admin Console / Billing code ownership (#4973)
* refactor: move SCIM component to admin-console, refs EC-1011
* refactor: move scimProviderType to admin-console, refs EC-1011
* refactor: move scim-config.api to admin-console, refs EC-1011
* refactor: create models folder and nest existing api contents, refs EC-1011
* refactor: move scim-config to admin-console models, refs EC-1011
* refactor: move billing.component to billing, refs EC-1011
* refactor: remove nested app folder from new billing structure, refs EC-1011
* refactor: move organizations/billing to billing, refs EC-1011
* refactor: move add-credit and adjust-payment to billing/settings, refs EC-1011
* refactor: billing history/sync to billing, refs EC-1011
* refactor: move org plans, payment/method to billing/settings, refs EC-1011
* fix: update legacy file paths for payment-method and tax-info, refs EC-1011
* fix: update imports for scim component, refs EC-1011
* refactor: move subscription and tax-info into billing, refs EC-1011
* refactor: move user-subscription to billing, refs EC-1011
* refactor: move images/cards to billing and update base path, refs EC-1011
* refactor: move payment-method, plan subscription, and plan to billing, refs EC-1011
* refactor: move transaction-type to billing, refs EC-1011
* refactor: move billing-sync-config to billing, refs EC-1011
* refactor: move billing-sync and bit-pay-invoice request to billing, refs EC-1011
* refactor: move org subscription and tax info update requests to billing, refs EC-1011
* fix: broken paths to billing, refs EC-1011
* refactor: move payment request to billing, refs EC-1011
* fix: update remaining imports for payment-request, refs EC-1011
* refactor: move tax-info-update to billing, refs EC-1011
* refactor: move billing-payment, billing-history, and billing responses to billing, refs EC-1011
* refactor: move organization-subscription-responset to billing, refs EC-1011
* refactor: move payment and plan responses to billing, refs EC-1011
* refactor: move subscription response to billing ,refs EC-1011
* refactor: move tax info and rate responses to billing, refs EC-1011
* fix: update remaining path to base response for tax-rate response, refs EC-1011
* refactor: (browser) move organization-service to admin-console, refs EC-1011
* refactor: (browser) move organizaiton-service to admin-console, refs EC-1011
* refactor: (cli) move share command to admin-console, refs EC-1011
* refactor: move organization-collect request model to admin-console, refs EC-1011
* refactor: (web) move organization, collection/user responses to admin-console, refs EC-1011
* refactor: (cli) move selection-read-only to admin-console, refs EC-1011
* refactor: (desktop) move organization-filter to admin-console, refs EC-1011
* refactor: (web) move organization-switcher to admin-console, refs EC-1011
* refactor: (web) move access-selector to admin-console, refs EC-1011
* refactor: (web) move create folder to admin-console, refs EC-1011
* refactor: (web) move org guards folder to admin-console, refs EC-1011
* refactor: (web) move org layout to admin-console, refs EC-1011
* refactor: move manage collections to admin console, refs EC-1011
* refactor: (web) move collection-dialog to admin-console, refs EC-1011
* refactor: (web) move entity users/events and events component to admin-console, refs EC-1011
* refactor: (web) move groups/group-add-edit to admin-console, refs EC-1011
* refactor: (web) move manage, org-manage module, and user-confirm to admin-console, refs EC-1011
* refactor: (web) move people to admin-console, refs EC-1011
* refactor: (web) move reset-password to admin-console, refs EC-1011
* refactor: (web) move organization-routing and module to admin-console, refs EC-1011
* refactor: move admin-console and billing within app scope, refs EC-1011
* fix: update leftover merge conflicts, refs EC-1011
* refactor: (web) member-dialog to admin-console, refs EC-1011
* refactor: (web) move policies to admin-console, refs EC-1011
* refactor: (web) move reporting to admin-console, refs EC-1011
* refactor: (web) move settings to admin-console, refs EC-1011
* refactor: (web) move sponsorships to admin-console, refs EC-1011
* refactor: (web) move tools to admin-console, refs EC-1011
* refactor: (web) move users to admin-console, refs EC-1011
* refactor: (web) move collections to admin-console, refs EC-1011
* refactor: (web) move create-organization to admin-console, refs EC-1011
* refactor: (web) move licensed components to admin-console, refs EC-1011
* refactor: (web) move bit organization modules to admin-console, refs EC-1011
* fix: update leftover import statements for organizations.module, refs EC-1011
* refactor: (web) move personal vault and max timeout to admin-console, refs EC-1011
* refactor: (web) move providers to admin-console, refs EC-1011
* refactor: (libs) move organization service to admin-console, refs EC-1011
* refactor: (libs) move profile org/provider responses and other misc org responses to admin-console, refs EC-1011
* refactor: (libs) move provider request and selectionion-read-only request to admin-console, refs EC-1011
* fix: update missed import path for provider-user-update request, refs EC-1011
* refactor: (libs) move abstractions to admin-console, refs EC-1011
* refactor: (libs) move org/provider enums to admin-console, refs EC-1011
* fix: update downstream import statements from libs changes, refs EC-1011
* refactor: (libs) move data files to admin-console, refs EC-1011
* refactor: (libs) move domain to admin-console, refs EC-1011
* refactor: (libs) move request objects to admin-console, refs EC-1011
* fix: update downstream import changes from libs, refs EC-1011
* refactor: move leftover provider files to admin-console, refs EC-1011
* refactor: (browser) move group policy environment to admin-console, refs EC-1011
* fix: (browser) update downstream import statements, refs EC-1011
* fix: (desktop) update downstream libs moves, refs EC-1011
* fix: (cli) update downstream import changes from libs, refs EC-1011
* refactor: move org-auth related files to admin-console, refs EC-1011
* refactor: (libs) move request objects to admin-console, refs EC-1011
* refactor: move persmissions to admin-console, refs EC-1011
* refactor: move sponsored families to admin-console and fix libs changes, refs EC-1011
* refactor: move collections to admin-console, refs EC-1011
* refactor: move spec file back to spec scope, refs EC-1011
* fix: update downstream imports due to libs changes, refs EC-1011
* fix: udpate downstream import changes due to libs, refs EC-1011
* fix: update downstream imports due to libs changes, refs EC-1011
* fix: update downstream imports from libs changes, refs EC-1011
* fix: update path malformation in jslib-services.module, refs EC-1011
* fix: lint errors from improper casing, refs AC-1011
* fix: update downstream filename changes, refs AC-1011
* fix: (cli) update downstream filename changes, refs AC-1011
* fix: (desktop) update downstream filename changes, refs AC-1011
* fix: (browser) update downstream filename changes, refs AC-1011
* fix: lint errors, refs AC-1011
* fix: prettier, refs AC-1011
* fix: lint fixes for import order, refs AC-1011
* fix: update import path for provider user type, refs AC-1011
* fix: update new codes import paths for admin console structure, refs AC-1011
* fix: lint/prettier, refs AC-1011
* fix: update layout stories path, refs AC-1011
* fix: update comoponents card icons base variable in styles, refs AC-1011
* fix: update provider service path in permissions guard spec, refs AC-1011
* fix: update provider permission guard path, refs AC-1011
* fix: remove unecessary TODO for shared index export statement, refs AC-1011
* refactor: move browser-organization service and cli organization-user response out of admin-console, refs AC-1011
* refactor: move web/browser/desktop collections component to vault domain, refs AC-1011
* refactor: move organization.module out of admin-console scope, refs AC-1011
* fix: prettier, refs AC-1011
* refactor: move organizations-api-key.request out of admin-console scope, refs AC-1011
2023-03-22 16:03:50 +01:00
|
|
|
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction";
|
2023-04-17 16:35:37 +02:00
|
|
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/policy/policy-api.service.abstraction";
|
[AC-1011] Admin Console / Billing code ownership (#4973)
* refactor: move SCIM component to admin-console, refs EC-1011
* refactor: move scimProviderType to admin-console, refs EC-1011
* refactor: move scim-config.api to admin-console, refs EC-1011
* refactor: create models folder and nest existing api contents, refs EC-1011
* refactor: move scim-config to admin-console models, refs EC-1011
* refactor: move billing.component to billing, refs EC-1011
* refactor: remove nested app folder from new billing structure, refs EC-1011
* refactor: move organizations/billing to billing, refs EC-1011
* refactor: move add-credit and adjust-payment to billing/settings, refs EC-1011
* refactor: billing history/sync to billing, refs EC-1011
* refactor: move org plans, payment/method to billing/settings, refs EC-1011
* fix: update legacy file paths for payment-method and tax-info, refs EC-1011
* fix: update imports for scim component, refs EC-1011
* refactor: move subscription and tax-info into billing, refs EC-1011
* refactor: move user-subscription to billing, refs EC-1011
* refactor: move images/cards to billing and update base path, refs EC-1011
* refactor: move payment-method, plan subscription, and plan to billing, refs EC-1011
* refactor: move transaction-type to billing, refs EC-1011
* refactor: move billing-sync-config to billing, refs EC-1011
* refactor: move billing-sync and bit-pay-invoice request to billing, refs EC-1011
* refactor: move org subscription and tax info update requests to billing, refs EC-1011
* fix: broken paths to billing, refs EC-1011
* refactor: move payment request to billing, refs EC-1011
* fix: update remaining imports for payment-request, refs EC-1011
* refactor: move tax-info-update to billing, refs EC-1011
* refactor: move billing-payment, billing-history, and billing responses to billing, refs EC-1011
* refactor: move organization-subscription-responset to billing, refs EC-1011
* refactor: move payment and plan responses to billing, refs EC-1011
* refactor: move subscription response to billing ,refs EC-1011
* refactor: move tax info and rate responses to billing, refs EC-1011
* fix: update remaining path to base response for tax-rate response, refs EC-1011
* refactor: (browser) move organization-service to admin-console, refs EC-1011
* refactor: (browser) move organizaiton-service to admin-console, refs EC-1011
* refactor: (cli) move share command to admin-console, refs EC-1011
* refactor: move organization-collect request model to admin-console, refs EC-1011
* refactor: (web) move organization, collection/user responses to admin-console, refs EC-1011
* refactor: (cli) move selection-read-only to admin-console, refs EC-1011
* refactor: (desktop) move organization-filter to admin-console, refs EC-1011
* refactor: (web) move organization-switcher to admin-console, refs EC-1011
* refactor: (web) move access-selector to admin-console, refs EC-1011
* refactor: (web) move create folder to admin-console, refs EC-1011
* refactor: (web) move org guards folder to admin-console, refs EC-1011
* refactor: (web) move org layout to admin-console, refs EC-1011
* refactor: move manage collections to admin console, refs EC-1011
* refactor: (web) move collection-dialog to admin-console, refs EC-1011
* refactor: (web) move entity users/events and events component to admin-console, refs EC-1011
* refactor: (web) move groups/group-add-edit to admin-console, refs EC-1011
* refactor: (web) move manage, org-manage module, and user-confirm to admin-console, refs EC-1011
* refactor: (web) move people to admin-console, refs EC-1011
* refactor: (web) move reset-password to admin-console, refs EC-1011
* refactor: (web) move organization-routing and module to admin-console, refs EC-1011
* refactor: move admin-console and billing within app scope, refs EC-1011
* fix: update leftover merge conflicts, refs EC-1011
* refactor: (web) member-dialog to admin-console, refs EC-1011
* refactor: (web) move policies to admin-console, refs EC-1011
* refactor: (web) move reporting to admin-console, refs EC-1011
* refactor: (web) move settings to admin-console, refs EC-1011
* refactor: (web) move sponsorships to admin-console, refs EC-1011
* refactor: (web) move tools to admin-console, refs EC-1011
* refactor: (web) move users to admin-console, refs EC-1011
* refactor: (web) move collections to admin-console, refs EC-1011
* refactor: (web) move create-organization to admin-console, refs EC-1011
* refactor: (web) move licensed components to admin-console, refs EC-1011
* refactor: (web) move bit organization modules to admin-console, refs EC-1011
* fix: update leftover import statements for organizations.module, refs EC-1011
* refactor: (web) move personal vault and max timeout to admin-console, refs EC-1011
* refactor: (web) move providers to admin-console, refs EC-1011
* refactor: (libs) move organization service to admin-console, refs EC-1011
* refactor: (libs) move profile org/provider responses and other misc org responses to admin-console, refs EC-1011
* refactor: (libs) move provider request and selectionion-read-only request to admin-console, refs EC-1011
* fix: update missed import path for provider-user-update request, refs EC-1011
* refactor: (libs) move abstractions to admin-console, refs EC-1011
* refactor: (libs) move org/provider enums to admin-console, refs EC-1011
* fix: update downstream import statements from libs changes, refs EC-1011
* refactor: (libs) move data files to admin-console, refs EC-1011
* refactor: (libs) move domain to admin-console, refs EC-1011
* refactor: (libs) move request objects to admin-console, refs EC-1011
* fix: update downstream import changes from libs, refs EC-1011
* refactor: move leftover provider files to admin-console, refs EC-1011
* refactor: (browser) move group policy environment to admin-console, refs EC-1011
* fix: (browser) update downstream import statements, refs EC-1011
* fix: (desktop) update downstream libs moves, refs EC-1011
* fix: (cli) update downstream import changes from libs, refs EC-1011
* refactor: move org-auth related files to admin-console, refs EC-1011
* refactor: (libs) move request objects to admin-console, refs EC-1011
* refactor: move persmissions to admin-console, refs EC-1011
* refactor: move sponsored families to admin-console and fix libs changes, refs EC-1011
* refactor: move collections to admin-console, refs EC-1011
* refactor: move spec file back to spec scope, refs EC-1011
* fix: update downstream imports due to libs changes, refs EC-1011
* fix: udpate downstream import changes due to libs, refs EC-1011
* fix: update downstream imports due to libs changes, refs EC-1011
* fix: update downstream imports from libs changes, refs EC-1011
* fix: update path malformation in jslib-services.module, refs EC-1011
* fix: lint errors from improper casing, refs AC-1011
* fix: update downstream filename changes, refs AC-1011
* fix: (cli) update downstream filename changes, refs AC-1011
* fix: (desktop) update downstream filename changes, refs AC-1011
* fix: (browser) update downstream filename changes, refs AC-1011
* fix: lint errors, refs AC-1011
* fix: prettier, refs AC-1011
* fix: lint fixes for import order, refs AC-1011
* fix: update import path for provider user type, refs AC-1011
* fix: update new codes import paths for admin console structure, refs AC-1011
* fix: lint/prettier, refs AC-1011
* fix: update layout stories path, refs AC-1011
* fix: update comoponents card icons base variable in styles, refs AC-1011
* fix: update provider service path in permissions guard spec, refs AC-1011
* fix: update provider permission guard path, refs AC-1011
* fix: remove unecessary TODO for shared index export statement, refs AC-1011
* refactor: move browser-organization service and cli organization-user response out of admin-console, refs AC-1011
* refactor: move web/browser/desktop collections component to vault domain, refs AC-1011
* refactor: move organization.module out of admin-console scope, refs AC-1011
* fix: prettier, refs AC-1011
* refactor: move organizations-api-key.request out of admin-console scope, refs AC-1011
2023-03-22 16:03:50 +01:00
|
|
|
import { CollectionService } from "@bitwarden/common/admin-console/services/collection.service";
|
|
|
|
import { OrganizationApiService } from "@bitwarden/common/admin-console/services/organization/organization-api.service";
|
|
|
|
import { OrganizationService } from "@bitwarden/common/admin-console/services/organization/organization.service";
|
2023-04-17 16:35:37 +02:00
|
|
|
import { PolicyApiService } from "@bitwarden/common/admin-console/services/policy/policy-api.service";
|
[AC-1011] Admin Console / Billing code ownership (#4973)
* refactor: move SCIM component to admin-console, refs EC-1011
* refactor: move scimProviderType to admin-console, refs EC-1011
* refactor: move scim-config.api to admin-console, refs EC-1011
* refactor: create models folder and nest existing api contents, refs EC-1011
* refactor: move scim-config to admin-console models, refs EC-1011
* refactor: move billing.component to billing, refs EC-1011
* refactor: remove nested app folder from new billing structure, refs EC-1011
* refactor: move organizations/billing to billing, refs EC-1011
* refactor: move add-credit and adjust-payment to billing/settings, refs EC-1011
* refactor: billing history/sync to billing, refs EC-1011
* refactor: move org plans, payment/method to billing/settings, refs EC-1011
* fix: update legacy file paths for payment-method and tax-info, refs EC-1011
* fix: update imports for scim component, refs EC-1011
* refactor: move subscription and tax-info into billing, refs EC-1011
* refactor: move user-subscription to billing, refs EC-1011
* refactor: move images/cards to billing and update base path, refs EC-1011
* refactor: move payment-method, plan subscription, and plan to billing, refs EC-1011
* refactor: move transaction-type to billing, refs EC-1011
* refactor: move billing-sync-config to billing, refs EC-1011
* refactor: move billing-sync and bit-pay-invoice request to billing, refs EC-1011
* refactor: move org subscription and tax info update requests to billing, refs EC-1011
* fix: broken paths to billing, refs EC-1011
* refactor: move payment request to billing, refs EC-1011
* fix: update remaining imports for payment-request, refs EC-1011
* refactor: move tax-info-update to billing, refs EC-1011
* refactor: move billing-payment, billing-history, and billing responses to billing, refs EC-1011
* refactor: move organization-subscription-responset to billing, refs EC-1011
* refactor: move payment and plan responses to billing, refs EC-1011
* refactor: move subscription response to billing ,refs EC-1011
* refactor: move tax info and rate responses to billing, refs EC-1011
* fix: update remaining path to base response for tax-rate response, refs EC-1011
* refactor: (browser) move organization-service to admin-console, refs EC-1011
* refactor: (browser) move organizaiton-service to admin-console, refs EC-1011
* refactor: (cli) move share command to admin-console, refs EC-1011
* refactor: move organization-collect request model to admin-console, refs EC-1011
* refactor: (web) move organization, collection/user responses to admin-console, refs EC-1011
* refactor: (cli) move selection-read-only to admin-console, refs EC-1011
* refactor: (desktop) move organization-filter to admin-console, refs EC-1011
* refactor: (web) move organization-switcher to admin-console, refs EC-1011
* refactor: (web) move access-selector to admin-console, refs EC-1011
* refactor: (web) move create folder to admin-console, refs EC-1011
* refactor: (web) move org guards folder to admin-console, refs EC-1011
* refactor: (web) move org layout to admin-console, refs EC-1011
* refactor: move manage collections to admin console, refs EC-1011
* refactor: (web) move collection-dialog to admin-console, refs EC-1011
* refactor: (web) move entity users/events and events component to admin-console, refs EC-1011
* refactor: (web) move groups/group-add-edit to admin-console, refs EC-1011
* refactor: (web) move manage, org-manage module, and user-confirm to admin-console, refs EC-1011
* refactor: (web) move people to admin-console, refs EC-1011
* refactor: (web) move reset-password to admin-console, refs EC-1011
* refactor: (web) move organization-routing and module to admin-console, refs EC-1011
* refactor: move admin-console and billing within app scope, refs EC-1011
* fix: update leftover merge conflicts, refs EC-1011
* refactor: (web) member-dialog to admin-console, refs EC-1011
* refactor: (web) move policies to admin-console, refs EC-1011
* refactor: (web) move reporting to admin-console, refs EC-1011
* refactor: (web) move settings to admin-console, refs EC-1011
* refactor: (web) move sponsorships to admin-console, refs EC-1011
* refactor: (web) move tools to admin-console, refs EC-1011
* refactor: (web) move users to admin-console, refs EC-1011
* refactor: (web) move collections to admin-console, refs EC-1011
* refactor: (web) move create-organization to admin-console, refs EC-1011
* refactor: (web) move licensed components to admin-console, refs EC-1011
* refactor: (web) move bit organization modules to admin-console, refs EC-1011
* fix: update leftover import statements for organizations.module, refs EC-1011
* refactor: (web) move personal vault and max timeout to admin-console, refs EC-1011
* refactor: (web) move providers to admin-console, refs EC-1011
* refactor: (libs) move organization service to admin-console, refs EC-1011
* refactor: (libs) move profile org/provider responses and other misc org responses to admin-console, refs EC-1011
* refactor: (libs) move provider request and selectionion-read-only request to admin-console, refs EC-1011
* fix: update missed import path for provider-user-update request, refs EC-1011
* refactor: (libs) move abstractions to admin-console, refs EC-1011
* refactor: (libs) move org/provider enums to admin-console, refs EC-1011
* fix: update downstream import statements from libs changes, refs EC-1011
* refactor: (libs) move data files to admin-console, refs EC-1011
* refactor: (libs) move domain to admin-console, refs EC-1011
* refactor: (libs) move request objects to admin-console, refs EC-1011
* fix: update downstream import changes from libs, refs EC-1011
* refactor: move leftover provider files to admin-console, refs EC-1011
* refactor: (browser) move group policy environment to admin-console, refs EC-1011
* fix: (browser) update downstream import statements, refs EC-1011
* fix: (desktop) update downstream libs moves, refs EC-1011
* fix: (cli) update downstream import changes from libs, refs EC-1011
* refactor: move org-auth related files to admin-console, refs EC-1011
* refactor: (libs) move request objects to admin-console, refs EC-1011
* refactor: move persmissions to admin-console, refs EC-1011
* refactor: move sponsored families to admin-console and fix libs changes, refs EC-1011
* refactor: move collections to admin-console, refs EC-1011
* refactor: move spec file back to spec scope, refs EC-1011
* fix: update downstream imports due to libs changes, refs EC-1011
* fix: udpate downstream import changes due to libs, refs EC-1011
* fix: update downstream imports due to libs changes, refs EC-1011
* fix: update downstream imports from libs changes, refs EC-1011
* fix: update path malformation in jslib-services.module, refs EC-1011
* fix: lint errors from improper casing, refs AC-1011
* fix: update downstream filename changes, refs AC-1011
* fix: (cli) update downstream filename changes, refs AC-1011
* fix: (desktop) update downstream filename changes, refs AC-1011
* fix: (browser) update downstream filename changes, refs AC-1011
* fix: lint errors, refs AC-1011
* fix: prettier, refs AC-1011
* fix: lint fixes for import order, refs AC-1011
* fix: update import path for provider user type, refs AC-1011
* fix: update new codes import paths for admin console structure, refs AC-1011
* fix: lint/prettier, refs AC-1011
* fix: update layout stories path, refs AC-1011
* fix: update comoponents card icons base variable in styles, refs AC-1011
* fix: update provider service path in permissions guard spec, refs AC-1011
* fix: update provider permission guard path, refs AC-1011
* fix: remove unecessary TODO for shared index export statement, refs AC-1011
* refactor: move browser-organization service and cli organization-user response out of admin-console, refs AC-1011
* refactor: move web/browser/desktop collections component to vault domain, refs AC-1011
* refactor: move organization.module out of admin-console scope, refs AC-1011
* fix: prettier, refs AC-1011
* refactor: move organizations-api-key.request out of admin-console scope, refs AC-1011
2023-03-22 16:03:50 +01:00
|
|
|
import { PolicyService } from "@bitwarden/common/admin-console/services/policy/policy.service";
|
|
|
|
import { ProviderService } from "@bitwarden/common/admin-console/services/provider.service";
|
2023-02-06 22:53:37 +01:00
|
|
|
import { AuthService } from "@bitwarden/common/auth/services/auth.service";
|
|
|
|
import { KeyConnectorService } from "@bitwarden/common/auth/services/key-connector.service";
|
|
|
|
import { TokenService } from "@bitwarden/common/auth/services/token.service";
|
|
|
|
import { TwoFactorService } from "@bitwarden/common/auth/services/two-factor.service";
|
|
|
|
import { UserVerificationApiService } from "@bitwarden/common/auth/services/user-verification/user-verification-api.service";
|
|
|
|
import { UserVerificationService } from "@bitwarden/common/auth/services/user-verification/user-verification.service";
|
[AC-1266] Enums filename conventions (#5140)
* refactor: update clientType enum
* refactor: update deviceType filename
* refactor: update encryptedExportType filename
* refactor: update encryptionType filename
* refactor: update eventType filename
* refactor: update fieldType filename
* refactor: update fileUploadType filename
* refactor: update hashPurpose filename
* refactor: update htmlStorageLocation filename
* refactor: update kdfType filename
* refactor: update keySuffixOptions filename
* refactor: update linkedIdType filename
* refactor: update logLevelType filename
* refactor: update nativeMessagingVersion filename
* refactor: update notificationType filename
* refactor: update productType filename
* refactor: update secureNoteType filename
* refactor: update stateVersion filename
* refactor: update storageLocation filename
* refactor: update themeType filename
* refactor: update uriMatchType filename
* fix: update kdfType classes missed in initial pass, refs AC-1266
* fix: missing import update for device-type
* refactor: add barrel file for enums and update pathed import statements, refs AC-1266
* fix: incorrect import statements for web, refs AC-1266
* fix: missed import statement updates (browser), refs AC-1266
* fix: missed import statement changes (cli), refs AC-1266
* fix: missed import statement changes (desktop), refs AC-1266
* fix: prettier, refs AC-1266
* refactor: (libs) update relative paths to use barrel file, refs AC-1266
* fix: missed find/replace import statements for SecureNoteType, refs AC-1266
* refactor: apply .enum suffix to enums folder and modify leftover relative paths, refs AC-1266
* fix: find/replace errors for native-messaging-version, refs AC-1266
2023-04-05 05:42:21 +02:00
|
|
|
import { ClientType, KeySuffixOptions, LogLevelType } from "@bitwarden/common/enums";
|
2023-06-06 22:34:53 +02:00
|
|
|
import { StateFactory } from "@bitwarden/common/platform/factories/state-factory";
|
|
|
|
import { Account } from "@bitwarden/common/platform/models/domain/account";
|
|
|
|
import { GlobalState } from "@bitwarden/common/platform/models/domain/global-state";
|
|
|
|
import { AppIdService } from "@bitwarden/common/platform/services/app-id.service";
|
|
|
|
import { BroadcasterService } from "@bitwarden/common/platform/services/broadcaster.service";
|
|
|
|
import { ContainerService } from "@bitwarden/common/platform/services/container.service";
|
|
|
|
import { CryptoService } from "@bitwarden/common/platform/services/crypto.service";
|
|
|
|
import { EncryptServiceImplementation } from "@bitwarden/common/platform/services/cryptography/encrypt.service.implementation";
|
|
|
|
import { EnvironmentService } from "@bitwarden/common/platform/services/environment.service";
|
|
|
|
import { FileUploadService } from "@bitwarden/common/platform/services/file-upload/file-upload.service";
|
|
|
|
import { MemoryStorageService } from "@bitwarden/common/platform/services/memory-storage.service";
|
|
|
|
import { NoopMessagingService } from "@bitwarden/common/platform/services/noop-messaging.service";
|
|
|
|
import { StateMigrationService } from "@bitwarden/common/platform/services/state-migration.service";
|
|
|
|
import { StateService } from "@bitwarden/common/platform/services/state.service";
|
2022-06-14 17:10:53 +02:00
|
|
|
import { AuditService } from "@bitwarden/common/services/audit.service";
|
2022-12-19 19:56:16 +01:00
|
|
|
import { OrganizationUserServiceImplementation } from "@bitwarden/common/services/organization-user/organization-user.service.implementation";
|
2022-06-14 17:10:53 +02:00
|
|
|
import { SearchService } from "@bitwarden/common/services/search.service";
|
|
|
|
import { SettingsService } from "@bitwarden/common/services/settings.service";
|
|
|
|
import { TotpService } from "@bitwarden/common/services/totp.service";
|
2022-08-30 16:11:19 +02:00
|
|
|
import { VaultTimeoutService } from "@bitwarden/common/services/vaultTimeout/vaultTimeout.service";
|
2022-08-30 22:30:43 +02:00
|
|
|
import { VaultTimeoutSettingsService } from "@bitwarden/common/services/vaultTimeout/vaultTimeoutSettings.service";
|
2023-03-10 21:39:46 +01:00
|
|
|
import {
|
|
|
|
PasswordGenerationService,
|
|
|
|
PasswordGenerationServiceAbstraction,
|
|
|
|
} from "@bitwarden/common/tools/generator/password";
|
2023-06-13 23:22:25 +02:00
|
|
|
import {
|
|
|
|
PasswordStrengthService,
|
|
|
|
PasswordStrengthServiceAbstraction,
|
|
|
|
} from "@bitwarden/common/tools/password-strength";
|
2023-03-29 16:23:37 +02:00
|
|
|
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service";
|
|
|
|
import { SendService } from "@bitwarden/common/tools/send/services/send.service";
|
2023-01-31 22:08:37 +01:00
|
|
|
import { InternalFolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction";
|
|
|
|
import { CipherService } from "@bitwarden/common/vault/services/cipher.service";
|
2023-03-28 18:37:40 +02:00
|
|
|
import { CipherFileUploadService } from "@bitwarden/common/vault/services/file-upload/cipher-file-upload.service";
|
2023-01-31 22:08:37 +01:00
|
|
|
import { FolderApiService } from "@bitwarden/common/vault/services/folder/folder-api.service";
|
|
|
|
import { FolderService } from "@bitwarden/common/vault/services/folder/folder.service";
|
|
|
|
import { SyncNotifierService } from "@bitwarden/common/vault/services/sync/sync-notifier.service";
|
|
|
|
import { SyncService } from "@bitwarden/common/vault/services/sync/sync.service";
|
2023-04-19 11:30:46 +02:00
|
|
|
import {
|
|
|
|
VaultExportService,
|
|
|
|
VaultExportServiceAbstraction,
|
|
|
|
} from "@bitwarden/exporter/vault-export";
|
2023-03-23 11:43:27 +01:00
|
|
|
import {
|
|
|
|
ImportApiService,
|
|
|
|
ImportApiServiceAbstraction,
|
|
|
|
ImportService,
|
|
|
|
ImportServiceAbstraction,
|
|
|
|
} from "@bitwarden/importer";
|
2022-11-17 15:46:49 +01:00
|
|
|
import { NodeCryptoFunctionService } from "@bitwarden/node/services/node-crypto-function.service";
|
2021-12-20 18:04:00 +01:00
|
|
|
|
2023-06-06 22:34:53 +02:00
|
|
|
import { CliPlatformUtilsService } from "./platform/services/cli-platform-utils.service";
|
|
|
|
import { ConsoleLogService } from "./platform/services/console-log.service";
|
|
|
|
import { I18nService } from "./platform/services/i18n.service";
|
|
|
|
import { LowdbStorageService } from "./platform/services/lowdb-storage.service";
|
|
|
|
import { NodeApiService } from "./platform/services/node-api.service";
|
|
|
|
import { NodeEnvSecureStorageService } from "./platform/services/node-env-secure-storage.service";
|
2018-05-14 17:15:54 +02:00
|
|
|
import { Program } from "./program";
|
2023-03-29 16:23:37 +02:00
|
|
|
import { SendProgram } from "./tools/send/send.program";
|
2021-02-03 18:44:33 +01:00
|
|
|
import { VaultProgram } from "./vault.program";
|
2018-05-13 06:19:14 +02:00
|
|
|
|
2019-02-07 21:46:22 +01:00
|
|
|
// Polyfills
|
2022-08-24 18:33:05 +02:00
|
|
|
global.DOMParser = new jsdom.JSDOM().window.DOMParser;
|
2019-02-07 21:46:22 +01:00
|
|
|
|
2022-03-03 18:24:41 +01:00
|
|
|
// eslint-disable-next-line
|
2019-03-16 03:34:59 +01:00
|
|
|
const packageJson = require("../package.json");
|
|
|
|
|
2018-05-14 17:15:54 +02:00
|
|
|
export class Main {
|
2018-05-16 05:26:36 +02:00
|
|
|
messagingService: NoopMessagingService;
|
2018-05-16 21:22:32 +02:00
|
|
|
storageService: LowdbStorageService;
|
|
|
|
secureStorageService: NodeEnvSecureStorageService;
|
2022-06-27 19:38:12 +02:00
|
|
|
memoryStorageService: MemoryStorageService;
|
2022-12-21 23:46:23 +01:00
|
|
|
i18nService: I18nService;
|
2019-03-16 03:34:59 +01:00
|
|
|
platformUtilsService: CliPlatformUtilsService;
|
2018-05-14 17:15:54 +02:00
|
|
|
cryptoService: CryptoService;
|
|
|
|
tokenService: TokenService;
|
|
|
|
appIdService: AppIdService;
|
|
|
|
apiService: NodeApiService;
|
2020-04-03 16:47:45 +02:00
|
|
|
environmentService: EnvironmentService;
|
2018-05-14 17:15:54 +02:00
|
|
|
settingsService: SettingsService;
|
|
|
|
cipherService: CipherService;
|
2022-07-08 15:40:31 +02:00
|
|
|
folderService: InternalFolderService;
|
2022-12-19 19:56:16 +01:00
|
|
|
organizationUserService: OrganizationUserService;
|
2018-05-14 17:15:54 +02:00
|
|
|
collectionService: CollectionService;
|
|
|
|
vaultTimeoutService: VaultTimeoutService;
|
2022-08-30 22:30:43 +02:00
|
|
|
vaultTimeoutSettingsService: VaultTimeoutSettingsService;
|
2020-11-23 21:56:40 +01:00
|
|
|
syncService: SyncService;
|
2023-03-10 21:39:46 +01:00
|
|
|
passwordGenerationService: PasswordGenerationServiceAbstraction;
|
2023-06-13 23:22:25 +02:00
|
|
|
passwordStrengthService: PasswordStrengthServiceAbstraction;
|
2021-11-16 10:42:30 +01:00
|
|
|
totpService: TotpService;
|
2019-03-16 03:34:59 +01:00
|
|
|
containerService: ContainerService;
|
2020-10-20 16:07:36 +02:00
|
|
|
auditService: AuditService;
|
2023-03-23 11:43:27 +01:00
|
|
|
importService: ImportServiceAbstraction;
|
2023-01-30 20:03:12 +01:00
|
|
|
importApiService: ImportApiServiceAbstraction;
|
2023-04-19 11:30:46 +02:00
|
|
|
exportService: VaultExportServiceAbstraction;
|
2021-02-04 05:51:59 +01:00
|
|
|
searchService: SearchService;
|
2018-05-14 17:15:54 +02:00
|
|
|
cryptoFunctionService: NodeCryptoFunctionService;
|
2022-10-27 23:38:54 +02:00
|
|
|
encryptService: EncryptServiceImplementation;
|
2020-10-20 16:07:36 +02:00
|
|
|
authService: AuthService;
|
2020-12-14 18:29:17 +01:00
|
|
|
policyService: PolicyService;
|
2023-04-17 16:35:37 +02:00
|
|
|
policyApiService: PolicyApiServiceAbstraction;
|
2020-12-14 18:29:17 +01:00
|
|
|
program: Program;
|
2021-02-03 18:44:33 +01:00
|
|
|
vaultProgram: VaultProgram;
|
2020-12-14 18:29:17 +01:00
|
|
|
sendProgram: SendProgram;
|
|
|
|
logService: ConsoleLogService;
|
2018-05-14 17:15:54 +02:00
|
|
|
sendService: SendService;
|
2021-03-29 16:47:39 +02:00
|
|
|
fileUploadService: FileUploadService;
|
2023-03-28 18:37:40 +02:00
|
|
|
cipherFileUploadService: CipherFileUploadService;
|
2018-05-14 17:15:54 +02:00
|
|
|
keyConnectorService: KeyConnectorService;
|
|
|
|
userVerificationService: UserVerificationService;
|
2021-12-28 21:38:51 +01:00
|
|
|
stateService: StateService;
|
|
|
|
stateMigrationService: StateMigrationService;
|
|
|
|
organizationService: OrganizationService;
|
|
|
|
providerService: ProviderService;
|
2022-02-08 00:31:36 +01:00
|
|
|
twoFactorService: TwoFactorService;
|
2022-07-12 20:25:18 +02:00
|
|
|
broadcasterService: BroadcasterService;
|
2022-07-08 15:40:31 +02:00
|
|
|
folderApiService: FolderApiService;
|
2022-08-10 03:31:02 +02:00
|
|
|
userVerificationApiService: UserVerificationApiService;
|
2022-08-24 18:33:05 +02:00
|
|
|
organizationApiService: OrganizationApiServiceAbstraction;
|
2022-09-27 22:25:19 +02:00
|
|
|
syncNotifierService: SyncNotifierService;
|
2023-03-28 18:37:40 +02:00
|
|
|
sendApiService: SendApiService;
|
2021-12-20 18:04:00 +01:00
|
|
|
|
2021-03-29 16:47:39 +02:00
|
|
|
constructor() {
|
|
|
|
let p = null;
|
2021-11-09 19:00:16 +01:00
|
|
|
const relativeDataDir = path.join(path.dirname(process.execPath), "bw-data");
|
2020-04-14 19:04:19 +02:00
|
|
|
if (fs.existsSync(relativeDataDir)) {
|
|
|
|
p = relativeDataDir;
|
|
|
|
} else if (process.env.BITWARDENCLI_APPDATA_DIR) {
|
|
|
|
p = path.resolve(process.env.BITWARDENCLI_APPDATA_DIR);
|
|
|
|
} else if (process.platform === "darwin") {
|
2020-03-03 22:29:10 +01:00
|
|
|
p = path.join(process.env.HOME, "Library/Application Support/Bitwarden CLI");
|
2020-08-03 18:30:32 +02:00
|
|
|
} else if (process.platform === "win32") {
|
|
|
|
p = path.join(process.env.APPDATA, "Bitwarden CLI");
|
|
|
|
} else if (process.env.XDG_CONFIG_HOME) {
|
2021-11-09 19:00:16 +01:00
|
|
|
p = path.join(process.env.XDG_CONFIG_HOME, "Bitwarden CLI");
|
|
|
|
} else {
|
|
|
|
p = path.join(process.env.HOME, ".config/Bitwarden CLI");
|
2018-05-14 17:15:54 +02:00
|
|
|
}
|
2018-05-11 19:47:18 +02:00
|
|
|
|
2022-12-21 23:46:23 +01:00
|
|
|
this.i18nService = new I18nService("en", "./locales");
|
2022-02-08 15:29:22 +01:00
|
|
|
this.platformUtilsService = new CliPlatformUtilsService(ClientType.Cli, packageJson);
|
2021-10-20 22:41:33 +02:00
|
|
|
this.logService = new ConsoleLogService(
|
2021-08-13 16:18:49 +02:00
|
|
|
this.platformUtilsService.isDev(),
|
2018-05-15 05:16:59 +02:00
|
|
|
(level) => process.env.BITWARDENCLI_DEBUG !== "true" && level <= LogLevelType.Info
|
2021-12-20 18:04:00 +01:00
|
|
|
);
|
2018-05-15 05:16:59 +02:00
|
|
|
this.cryptoFunctionService = new NodeCryptoFunctionService();
|
2022-10-27 23:38:54 +02:00
|
|
|
this.encryptService = new EncryptServiceImplementation(
|
|
|
|
this.cryptoFunctionService,
|
|
|
|
this.logService,
|
|
|
|
true
|
|
|
|
);
|
2022-02-10 17:24:41 +01:00
|
|
|
this.storageService = new LowdbStorageService(this.logService, null, p, false, true);
|
2020-12-14 18:29:17 +01:00
|
|
|
this.secureStorageService = new NodeEnvSecureStorageService(
|
2018-05-16 03:11:58 +02:00
|
|
|
this.storageService,
|
2021-03-29 16:47:39 +02:00
|
|
|
this.logService,
|
2020-12-14 18:29:17 +01:00
|
|
|
() => this.cryptoService
|
2021-12-20 18:04:00 +01:00
|
|
|
);
|
2021-12-28 21:38:51 +01:00
|
|
|
|
2022-06-27 19:38:12 +02:00
|
|
|
this.memoryStorageService = new MemoryStorageService();
|
|
|
|
|
2021-12-28 21:38:51 +01:00
|
|
|
this.stateMigrationService = new StateMigrationService(
|
|
|
|
this.storageService,
|
2022-02-01 00:00:19 +01:00
|
|
|
this.secureStorageService,
|
2022-02-03 20:08:45 +01:00
|
|
|
new StateFactory(GlobalState, Account)
|
2021-12-28 21:38:51 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
this.stateService = new StateService(
|
2018-05-14 17:15:54 +02:00
|
|
|
this.storageService,
|
2018-05-16 03:11:58 +02:00
|
|
|
this.secureStorageService,
|
2022-06-27 19:38:12 +02:00
|
|
|
this.memoryStorageService,
|
2021-12-28 21:38:51 +01:00
|
|
|
this.logService,
|
2022-01-20 21:03:37 +01:00
|
|
|
this.stateMigrationService,
|
2022-02-01 00:00:19 +01:00
|
|
|
new StateFactory(GlobalState, Account)
|
2021-12-28 21:38:51 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
this.cryptoService = new CryptoService(
|
2021-10-20 22:41:33 +02:00
|
|
|
this.cryptoFunctionService,
|
2022-06-27 19:38:12 +02:00
|
|
|
this.encryptService,
|
2021-07-23 22:46:32 +02:00
|
|
|
this.platformUtilsService,
|
2021-12-28 21:38:51 +01:00
|
|
|
this.logService,
|
|
|
|
this.stateService
|
2021-12-20 18:04:00 +01:00
|
|
|
);
|
2021-12-28 21:38:51 +01:00
|
|
|
|
2018-05-14 17:15:54 +02:00
|
|
|
this.appIdService = new AppIdService(this.storageService);
|
2021-12-28 21:38:51 +01:00
|
|
|
this.tokenService = new TokenService(this.stateService);
|
2018-05-16 05:26:36 +02:00
|
|
|
this.messagingService = new NoopMessagingService();
|
2021-12-28 21:38:51 +01:00
|
|
|
this.environmentService = new EnvironmentService(this.stateService);
|
2022-04-01 03:50:48 +02:00
|
|
|
|
|
|
|
const customUserAgent =
|
|
|
|
"Bitwarden_CLI/" +
|
|
|
|
this.platformUtilsService.getApplicationVersionSync() +
|
|
|
|
" (" +
|
|
|
|
this.platformUtilsService.getDeviceString().toUpperCase() +
|
|
|
|
")";
|
2021-07-23 22:46:32 +02:00
|
|
|
this.apiService = new NodeApiService(
|
2021-11-16 10:42:30 +01:00
|
|
|
this.tokenService,
|
2021-07-23 22:46:32 +02:00
|
|
|
this.platformUtilsService,
|
|
|
|
this.environmentService,
|
2022-04-01 03:50:48 +02:00
|
|
|
this.appIdService,
|
2018-05-15 05:16:59 +02:00
|
|
|
async (expired: boolean) => await this.logout(),
|
2022-04-01 03:50:48 +02:00
|
|
|
customUserAgent
|
2021-12-20 18:04:00 +01:00
|
|
|
);
|
2022-08-24 18:33:05 +02:00
|
|
|
|
2022-09-27 22:25:19 +02:00
|
|
|
this.syncNotifierService = new SyncNotifierService();
|
|
|
|
|
|
|
|
this.organizationApiService = new OrganizationApiService(this.apiService, this.syncService);
|
2022-08-24 18:33:05 +02:00
|
|
|
|
2022-09-02 03:15:19 +02:00
|
|
|
this.containerService = new ContainerService(this.cryptoService, this.encryptService);
|
2021-12-28 21:38:51 +01:00
|
|
|
|
|
|
|
this.settingsService = new SettingsService(this.stateService);
|
|
|
|
|
2023-03-28 18:37:40 +02:00
|
|
|
this.fileUploadService = new FileUploadService(this.logService);
|
|
|
|
|
|
|
|
this.sendService = new SendService(
|
|
|
|
this.cryptoService,
|
|
|
|
this.i18nService,
|
|
|
|
this.cryptoFunctionService,
|
|
|
|
this.stateService
|
|
|
|
);
|
|
|
|
|
|
|
|
this.cipherFileUploadService = new CipherFileUploadService(
|
|
|
|
this.apiService,
|
|
|
|
this.fileUploadService
|
|
|
|
);
|
|
|
|
|
|
|
|
this.sendApiService = this.sendApiService = new SendApiService(
|
|
|
|
this.apiService,
|
|
|
|
this.fileUploadService,
|
|
|
|
this.sendService
|
|
|
|
);
|
2021-12-28 21:38:51 +01:00
|
|
|
|
2023-04-07 17:11:20 +02:00
|
|
|
this.searchService = new SearchService(this.logService, this.i18nService);
|
|
|
|
|
2018-05-14 17:15:54 +02:00
|
|
|
this.cipherService = new CipherService(
|
|
|
|
this.cryptoService,
|
|
|
|
this.settingsService,
|
2018-08-06 15:38:17 +02:00
|
|
|
this.apiService,
|
2018-05-15 05:16:59 +02:00
|
|
|
this.i18nService,
|
2023-04-07 17:11:20 +02:00
|
|
|
this.searchService,
|
2022-10-27 23:38:54 +02:00
|
|
|
this.stateService,
|
2023-03-28 18:37:40 +02:00
|
|
|
this.encryptService,
|
|
|
|
this.cipherFileUploadService
|
2021-12-20 18:04:00 +01:00
|
|
|
);
|
2021-12-28 21:38:51 +01:00
|
|
|
|
2022-07-12 20:25:18 +02:00
|
|
|
this.broadcasterService = new BroadcasterService();
|
|
|
|
|
2018-06-25 21:03:57 +02:00
|
|
|
this.folderService = new FolderService(
|
2018-05-14 17:15:54 +02:00
|
|
|
this.cryptoService,
|
2021-11-16 10:42:30 +01:00
|
|
|
this.i18nService,
|
2021-12-28 21:38:51 +01:00
|
|
|
this.cipherService,
|
2022-07-18 14:39:12 +02:00
|
|
|
this.stateService
|
2021-12-20 18:04:00 +01:00
|
|
|
);
|
2021-12-28 21:38:51 +01:00
|
|
|
|
2022-07-08 15:40:31 +02:00
|
|
|
this.folderApiService = new FolderApiService(this.folderService, this.apiService);
|
|
|
|
|
2021-11-16 10:42:30 +01:00
|
|
|
this.collectionService = new CollectionService(
|
|
|
|
this.cryptoService,
|
2021-12-28 21:38:51 +01:00
|
|
|
this.i18nService,
|
|
|
|
this.stateService
|
2021-12-20 18:04:00 +01:00
|
|
|
);
|
2021-12-28 21:38:51 +01:00
|
|
|
|
|
|
|
this.providerService = new ProviderService(this.stateService);
|
|
|
|
|
2022-11-18 22:38:28 +01:00
|
|
|
this.organizationService = new OrganizationService(this.stateService);
|
2021-12-28 21:38:51 +01:00
|
|
|
|
2022-12-19 19:56:16 +01:00
|
|
|
this.organizationUserService = new OrganizationUserServiceImplementation(this.apiService);
|
|
|
|
|
2022-08-08 11:04:36 +02:00
|
|
|
this.policyService = new PolicyService(this.stateService, this.organizationService);
|
2021-12-28 21:38:51 +01:00
|
|
|
|
2023-04-17 16:35:37 +02:00
|
|
|
this.policyApiService = new PolicyApiService(
|
|
|
|
this.policyService,
|
|
|
|
this.apiService,
|
|
|
|
this.stateService
|
|
|
|
);
|
|
|
|
|
2021-11-09 19:00:16 +01:00
|
|
|
this.keyConnectorService = new KeyConnectorService(
|
2021-12-28 21:38:51 +01:00
|
|
|
this.stateService,
|
2021-11-16 10:42:30 +01:00
|
|
|
this.cryptoService,
|
2018-07-08 05:52:06 +02:00
|
|
|
this.apiService,
|
2018-05-14 17:15:54 +02:00
|
|
|
this.tokenService,
|
2021-12-28 21:38:51 +01:00
|
|
|
this.logService,
|
2022-02-08 00:31:36 +01:00
|
|
|
this.organizationService,
|
2022-05-26 03:16:05 +02:00
|
|
|
this.cryptoFunctionService,
|
|
|
|
async (expired: boolean) => await this.logout()
|
2021-12-20 18:04:00 +01:00
|
|
|
);
|
2021-12-28 21:38:51 +01:00
|
|
|
|
2022-05-16 03:58:36 +02:00
|
|
|
this.twoFactorService = new TwoFactorService(this.i18nService, this.platformUtilsService);
|
|
|
|
|
2023-06-13 23:22:25 +02:00
|
|
|
this.passwordStrengthService = new PasswordStrengthService();
|
|
|
|
|
2023-04-17 16:35:37 +02:00
|
|
|
this.passwordGenerationService = new PasswordGenerationService(
|
|
|
|
this.cryptoService,
|
|
|
|
this.policyService,
|
|
|
|
this.stateService
|
|
|
|
);
|
|
|
|
|
2022-05-16 03:58:36 +02:00
|
|
|
this.authService = new AuthService(
|
|
|
|
this.cryptoService,
|
|
|
|
this.apiService,
|
|
|
|
this.tokenService,
|
|
|
|
this.appIdService,
|
|
|
|
this.platformUtilsService,
|
|
|
|
this.messagingService,
|
|
|
|
this.logService,
|
|
|
|
this.keyConnectorService,
|
|
|
|
this.environmentService,
|
|
|
|
this.stateService,
|
|
|
|
this.twoFactorService,
|
2023-02-05 16:57:21 +01:00
|
|
|
this.i18nService,
|
2023-04-17 16:35:37 +02:00
|
|
|
this.encryptService,
|
2023-06-13 23:22:25 +02:00
|
|
|
this.passwordStrengthService,
|
2023-04-17 16:35:37 +02:00
|
|
|
this.policyService
|
2022-05-16 03:58:36 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
const lockedCallback = async () =>
|
|
|
|
await this.cryptoService.clearStoredKey(KeySuffixOptions.Auto);
|
|
|
|
|
2022-08-30 22:30:43 +02:00
|
|
|
this.vaultTimeoutSettingsService = new VaultTimeoutSettingsService(
|
|
|
|
this.cryptoService,
|
|
|
|
this.tokenService,
|
|
|
|
this.policyService,
|
|
|
|
this.stateService
|
|
|
|
);
|
|
|
|
|
2020-04-14 19:04:19 +02:00
|
|
|
this.vaultTimeoutService = new VaultTimeoutService(
|
2021-05-25 23:42:59 +02:00
|
|
|
this.cipherService,
|
|
|
|
this.folderService,
|
|
|
|
this.collectionService,
|
2021-11-16 10:42:30 +01:00
|
|
|
this.cryptoService,
|
2021-05-25 23:42:59 +02:00
|
|
|
this.platformUtilsService,
|
2020-11-23 21:56:40 +01:00
|
|
|
this.messagingService,
|
2021-09-15 15:57:43 +02:00
|
|
|
this.searchService,
|
2021-11-09 19:00:16 +01:00
|
|
|
this.keyConnectorService,
|
2021-12-28 21:38:51 +01:00
|
|
|
this.stateService,
|
2022-05-16 03:58:36 +02:00
|
|
|
this.authService,
|
2022-08-30 22:30:43 +02:00
|
|
|
this.vaultTimeoutSettingsService,
|
2022-05-16 03:58:36 +02:00
|
|
|
lockedCallback,
|
2021-12-20 18:04:00 +01:00
|
|
|
null
|
|
|
|
);
|
2021-12-28 21:38:51 +01:00
|
|
|
|
2018-05-14 17:15:54 +02:00
|
|
|
this.syncService = new SyncService(
|
2018-07-08 05:52:06 +02:00
|
|
|
this.apiService,
|
2018-05-14 17:15:54 +02:00
|
|
|
this.settingsService,
|
2021-05-25 23:42:59 +02:00
|
|
|
this.folderService,
|
|
|
|
this.cipherService,
|
2021-11-16 10:42:30 +01:00
|
|
|
this.cryptoService,
|
2021-05-25 23:42:59 +02:00
|
|
|
this.collectionService,
|
2020-11-23 21:56:40 +01:00
|
|
|
this.messagingService,
|
|
|
|
this.policyService,
|
|
|
|
this.sendService,
|
2021-11-09 19:00:16 +01:00
|
|
|
this.logService,
|
|
|
|
this.keyConnectorService,
|
2021-12-28 21:38:51 +01:00
|
|
|
this.stateService,
|
|
|
|
this.providerService,
|
2022-07-08 15:40:31 +02:00
|
|
|
this.folderApiService,
|
2022-11-18 22:38:28 +01:00
|
|
|
this.organizationService,
|
2023-03-28 18:37:40 +02:00
|
|
|
this.sendApiService,
|
2018-05-15 05:16:59 +02:00
|
|
|
async (expired: boolean) => await this.logout()
|
2021-12-20 18:04:00 +01:00
|
|
|
);
|
2021-12-28 21:38:51 +01:00
|
|
|
|
2022-06-23 09:53:42 +02:00
|
|
|
this.totpService = new TotpService(this.cryptoFunctionService, this.logService);
|
2021-12-28 21:38:51 +01:00
|
|
|
|
2023-01-30 20:03:12 +01:00
|
|
|
this.importApiService = new ImportApiService(this.apiService);
|
|
|
|
|
2018-08-06 15:38:17 +02:00
|
|
|
this.importService = new ImportService(
|
2021-05-25 23:42:59 +02:00
|
|
|
this.cipherService,
|
|
|
|
this.folderService,
|
2023-01-30 20:03:12 +01:00
|
|
|
this.importApiService,
|
2021-11-16 10:42:30 +01:00
|
|
|
this.i18nService,
|
2021-05-25 23:42:59 +02:00
|
|
|
this.collectionService,
|
2021-11-16 10:42:30 +01:00
|
|
|
this.cryptoService
|
2021-12-20 18:04:00 +01:00
|
|
|
);
|
2023-04-19 11:30:46 +02:00
|
|
|
this.exportService = new VaultExportService(
|
2021-05-25 23:42:59 +02:00
|
|
|
this.folderService,
|
|
|
|
this.cipherService,
|
2018-07-08 05:52:06 +02:00
|
|
|
this.apiService,
|
2022-02-08 00:31:36 +01:00
|
|
|
this.cryptoService,
|
2023-03-31 13:49:07 +02:00
|
|
|
this.cryptoFunctionService,
|
|
|
|
this.stateService
|
2021-12-20 18:04:00 +01:00
|
|
|
);
|
2021-12-28 21:38:51 +01:00
|
|
|
|
2018-07-08 05:52:06 +02:00
|
|
|
this.auditService = new AuditService(this.cryptoFunctionService, this.apiService);
|
2018-05-14 17:15:54 +02:00
|
|
|
this.program = new Program(this);
|
2021-02-03 18:44:33 +01:00
|
|
|
this.vaultProgram = new VaultProgram(this);
|
|
|
|
this.sendProgram = new SendProgram(this);
|
2022-08-10 03:31:02 +02:00
|
|
|
|
|
|
|
this.userVerificationApiService = new UserVerificationApiService(this.apiService);
|
|
|
|
|
2021-11-16 10:42:30 +01:00
|
|
|
this.userVerificationService = new UserVerificationService(
|
|
|
|
this.cryptoService,
|
|
|
|
this.i18nService,
|
2022-08-10 03:31:02 +02:00
|
|
|
this.userVerificationApiService
|
2021-12-20 18:04:00 +01:00
|
|
|
);
|
|
|
|
}
|
2021-02-03 18:44:33 +01:00
|
|
|
|
2021-04-12 17:13:00 +02:00
|
|
|
async run() {
|
|
|
|
await this.init();
|
2021-02-03 18:44:33 +01:00
|
|
|
|
2021-04-12 17:13:00 +02:00
|
|
|
await this.program.register();
|
2021-02-03 18:44:33 +01:00
|
|
|
await this.vaultProgram.register();
|
|
|
|
await this.sendProgram.register();
|
|
|
|
|
|
|
|
program.parse(process.argv);
|
|
|
|
|
|
|
|
if (process.argv.slice(2).length === 0) {
|
|
|
|
program.outputHelp();
|
2018-05-15 05:16:59 +02:00
|
|
|
}
|
2021-12-20 18:04:00 +01:00
|
|
|
}
|
2018-05-15 05:16:59 +02:00
|
|
|
|
2018-05-16 05:26:36 +02:00
|
|
|
async logout() {
|
2022-01-20 21:03:37 +01:00
|
|
|
this.authService.logOut(() => {
|
|
|
|
/* Do nothing */
|
|
|
|
});
|
2021-12-28 21:38:51 +01:00
|
|
|
const userId = await this.stateService.getUserId();
|
2018-05-16 05:26:36 +02:00
|
|
|
await Promise.all([
|
|
|
|
this.syncService.setLastSync(new Date(0)),
|
|
|
|
this.cryptoService.clearKeys(),
|
|
|
|
this.settingsService.clear(userId),
|
|
|
|
this.cipherService.clear(userId),
|
|
|
|
this.folderService.clear(userId),
|
|
|
|
this.collectionService.clear(userId),
|
2020-01-29 04:37:44 +01:00
|
|
|
this.policyService.clear(userId),
|
2018-05-16 05:26:36 +02:00
|
|
|
this.passwordGenerationService.clear(),
|
|
|
|
]);
|
2021-12-28 21:38:51 +01:00
|
|
|
await this.stateService.clean();
|
2018-05-16 05:28:03 +02:00
|
|
|
process.env.BW_SESSION = null;
|
2018-05-16 05:26:36 +02:00
|
|
|
}
|
2021-12-20 18:04:00 +01:00
|
|
|
|
2018-05-14 17:15:54 +02:00
|
|
|
private async init() {
|
2021-03-02 17:05:20 +01:00
|
|
|
await this.storageService.init();
|
2021-12-28 21:38:51 +01:00
|
|
|
await this.stateService.init();
|
2022-07-22 18:41:02 +02:00
|
|
|
this.containerService.attachToGlobal(global);
|
2018-05-14 17:15:54 +02:00
|
|
|
await this.environmentService.setUrlsFromStorage();
|
2021-12-28 21:38:51 +01:00
|
|
|
const locale = await this.stateService.getLocale();
|
2018-05-14 17:15:54 +02:00
|
|
|
await this.i18nService.init(locale);
|
2022-02-08 00:31:36 +01:00
|
|
|
this.twoFactorService.init();
|
2018-05-16 05:26:36 +02:00
|
|
|
|
2021-12-28 21:38:51 +01:00
|
|
|
const installedVersion = await this.stateService.getInstalledVersion();
|
2021-04-12 17:13:00 +02:00
|
|
|
const currentVersion = await this.platformUtilsService.getApplicationVersion();
|
2018-05-17 03:19:23 +02:00
|
|
|
if (installedVersion == null || installedVersion !== currentVersion) {
|
2021-12-28 21:38:51 +01:00
|
|
|
await this.stateService.setInstalledVersion(currentVersion);
|
2018-05-14 17:15:54 +02:00
|
|
|
}
|
2021-12-20 18:04:00 +01:00
|
|
|
}
|
2018-05-14 17:15:54 +02:00
|
|
|
}
|
2018-05-14 17:59:34 +02:00
|
|
|
|
2018-05-15 05:16:59 +02:00
|
|
|
const main = new Main();
|
|
|
|
main.run();
|