1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 05:43:41 +00:00

[PM-21378] Switch encrypt service to use SDK functions (#14538)

* Add new encrypt service functions

* Undo changes

* Cleanup

* Fix build

* Fix comments

* Switch encrypt service to use SDK functions

* Move remaining functions to PureCrypto

* Tests

* Increase test coverage

* Enforce sdk.ready and drop unused codepaths

* Delete unused code

* Add forgotten sdk init logic

* Fix build error

* Fix browser extension failing to unlock after process reload due to outdated usage of decryptString

* Fix send encryption

* Fix client key half decryption being stuck

* Attempt to fix sharereplay

* Fix build

* Fix type / add filter / add distinctuntilchange

* Fix capitalization
This commit is contained in:
Bernd Schoolmann
2025-07-21 15:52:38 +02:00
committed by GitHub
parent 8dc97ca1a7
commit 8b5e6adc37
18 changed files with 306 additions and 1628 deletions

View File

@@ -12,6 +12,7 @@ import { AccountServiceImplementation } from "@bitwarden/common/auth/services/ac
import { ClientType } from "@bitwarden/common/enums";
import { EncryptServiceImplementation } from "@bitwarden/common/key-management/crypto/services/encrypt.service.implementation";
import { RegionConfig } from "@bitwarden/common/platform/abstractions/environment.service";
import { SdkLoadService } from "@bitwarden/common/platform/abstractions/sdk/sdk-load.service";
import { Message, MessageSender } from "@bitwarden/common/platform/messaging";
// eslint-disable-next-line no-restricted-imports -- For dependency creation
import { SubjectMessageSender } from "@bitwarden/common/platform/messaging/internal";
@@ -58,6 +59,7 @@ import { EphemeralValueStorageService } from "./platform/services/ephemeral-valu
import { I18nMainService } from "./platform/services/i18n.main.service";
import { SSOLocalhostCallbackService } from "./platform/services/sso-localhost-callback.service";
import { ElectronMainMessagingService } from "./services/electron-main-messaging.service";
import { MainSdkLoadService } from "./services/main-sdk-load-service";
import { isMacAppStore } from "./utils";
export class Main {
@@ -88,6 +90,7 @@ export class Main {
desktopAutofillSettingsService: DesktopAutofillSettingsService;
versionMain: VersionMain;
sshAgentService: MainSshAgentService;
sdkLoadService: SdkLoadService;
mainDesktopAutotypeService: MainDesktopAutotypeService;
constructor() {
@@ -144,6 +147,8 @@ export class Main {
this.i18nService = new I18nMainService("en", "./locales/", globalStateProvider);
this.sdkLoadService = new MainSdkLoadService();
this.mainCryptoFunctionService = new NodeCryptoFunctionService();
const stateEventRegistrarService = new StateEventRegistrarService(
@@ -386,6 +391,8 @@ export class Main {
this.windowMain.win.on("minimize", () => {
this.messagingService.send("windowHidden");
});
await this.sdkLoadService.loadAndInit();
},
(e: any) => {
this.logService.error("Error while running migrations:", e);