1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-17 10:55:20 +01:00

Updated CryptoService DI to use getBgService again (#8146)

This commit is contained in:
Todd Martin 2024-02-28 16:08:44 -05:00 committed by GitHub
parent ea0f5fa771
commit 745a0c987a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -114,7 +114,6 @@ import { BrowserApi } from "../../platform/browser/browser-api";
import BrowserPopupUtils from "../../platform/popup/browser-popup-utils"; import BrowserPopupUtils from "../../platform/popup/browser-popup-utils";
import { BrowserStateService as StateServiceAbstraction } from "../../platform/services/abstractions/browser-state.service"; import { BrowserStateService as StateServiceAbstraction } from "../../platform/services/abstractions/browser-state.service";
import { BrowserConfigService } from "../../platform/services/browser-config.service"; import { BrowserConfigService } from "../../platform/services/browser-config.service";
import { BrowserCryptoService } from "../../platform/services/browser-crypto.service";
import { BrowserEnvironmentService } from "../../platform/services/browser-environment.service"; import { BrowserEnvironmentService } from "../../platform/services/browser-environment.service";
import { BrowserFileDownloadService } from "../../platform/services/browser-file-download.service"; import { BrowserFileDownloadService } from "../../platform/services/browser-file-download.service";
import { BrowserI18nService } from "../../platform/services/browser-i18n.service"; import { BrowserI18nService } from "../../platform/services/browser-i18n.service";
@ -269,39 +268,12 @@ function getBgService<T>(service: keyof MainBackground) {
}, },
{ {
provide: CryptoService, provide: CryptoService,
useFactory: ( useFactory: (encryptService: EncryptService) => {
keyGenerationService: KeyGenerationService, const cryptoService = getBgService<CryptoService>("cryptoService")();
cryptoFunctionService: CryptoFunctionService,
encryptService: EncryptService,
platformUtilsService: PlatformUtilsService,
logService: LogServiceAbstraction,
stateService: StateServiceAbstraction,
accountService: AccountServiceAbstraction,
stateProvider: StateProvider,
) => {
const cryptoService = new BrowserCryptoService(
keyGenerationService,
cryptoFunctionService,
encryptService,
platformUtilsService,
logService,
stateService,
accountService,
stateProvider,
);
new ContainerService(cryptoService, encryptService).attachToGlobal(self); new ContainerService(cryptoService, encryptService).attachToGlobal(self);
return cryptoService; return cryptoService;
}, },
deps: [ deps: [EncryptService],
KeyGenerationService,
CryptoFunctionService,
EncryptService,
PlatformUtilsService,
LogServiceAbstraction,
StateServiceAbstraction,
AccountServiceAbstraction,
StateProvider,
],
}, },
{ {
provide: AuthRequestServiceAbstraction, provide: AuthRequestServiceAbstraction,