1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-19 08:53:28 +00:00

[PM-25417] DIRT API Service Refactor (ADR-0005) (#16353)

* encode username for uri and add spec

* verify response from getHibpBreach method

* test/validate for BreachAccountResponse type and length instead of mock response

* - extract dirt api method out of global api service
- create new directory structure
- change imports accordingly
- extract breach account response
- put extracted code into new dirt dir

* codeowners and dep injection for new hibp service
This commit is contained in:
Alex
2025-09-22 10:06:58 -04:00
committed by GitHub
parent 3a721b535c
commit 8531109081
21 changed files with 132 additions and 48 deletions

View File

@@ -81,6 +81,7 @@ import {
import { isUrlInList } from "@bitwarden/common/autofill/utils";
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
import { DefaultBillingAccountProfileStateService } from "@bitwarden/common/billing/services/account/billing-account-profile-state.service";
import { HibpApiService } from "@bitwarden/common/dirt/services/hibp-api.service";
import { ClientType } from "@bitwarden/common/enums";
import { ProcessReloadServiceAbstraction } from "@bitwarden/common/key-management/abstractions/process-reload.service";
import {
@@ -347,6 +348,7 @@ export default class MainBackground {
tokenService: TokenServiceAbstraction;
appIdService: AppIdServiceAbstraction;
apiService: ApiServiceAbstraction;
hibpApiService: HibpApiService;
environmentService: BrowserEnvironmentService;
cipherService: CipherServiceAbstraction;
folderService: InternalFolderServiceAbstraction;
@@ -764,6 +766,7 @@ export default class MainBackground {
{ createRequest: (url, request) => new Request(url, request) },
);
this.hibpApiService = new HibpApiService(this.apiService);
this.fileUploadService = new FileUploadService(this.logService, this.apiService);
this.cipherFileUploadService = new CipherFileUploadService(
this.apiService,
@@ -1064,7 +1067,11 @@ export default class MainBackground {
this.userNotificationSettingsService,
messageListener,
);
this.auditService = new AuditService(this.cryptoFunctionService, this.apiService);
this.auditService = new AuditService(
this.cryptoFunctionService,
this.apiService,
this.hibpApiService,
);
this.importApiService = new ImportApiService(this.apiService);