1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 23:33:31 +00:00

[PM-6797] Prevent account switching race condition on desktop & enable worker decryption (#9312)

* Prevent account switching race condition on desktop

This enables us to allow background thread / multithread bulk decryption on desktop.

* Disable account switcher component during switching
This commit is contained in:
Bernd Schoolmann
2024-07-11 14:11:51 +02:00
committed by GitHub
parent f03dabb6d6
commit e977dacdcf
7 changed files with 22 additions and 26 deletions

View File

@@ -154,7 +154,7 @@ import { StateFactory } from "@bitwarden/common/platform/factories/state-factory
import { Message, MessageListener, MessageSender } from "@bitwarden/common/platform/messaging";
// eslint-disable-next-line no-restricted-imports -- Used for dependency injection
import { SubjectMessageSender } from "@bitwarden/common/platform/messaging/internal";
import { devFlagEnabled, flagEnabled } from "@bitwarden/common/platform/misc/flags";
import { devFlagEnabled } from "@bitwarden/common/platform/misc/flags";
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";
@@ -162,7 +162,6 @@ import { ConfigApiService } from "@bitwarden/common/platform/services/config/con
import { DefaultConfigService } from "@bitwarden/common/platform/services/config/default-config.service";
import { ConsoleLogService } from "@bitwarden/common/platform/services/console-log.service";
import { CryptoService } from "@bitwarden/common/platform/services/crypto.service";
import { EncryptServiceImplementation } from "@bitwarden/common/platform/services/cryptography/encrypt.service.implementation";
import { MultithreadEncryptServiceImplementation } from "@bitwarden/common/platform/services/cryptography/multithread-encrypt.service.implementation";
import { DefaultBroadcasterService } from "@bitwarden/common/platform/services/default-broadcaster.service";
import { DefaultEnvironmentService } from "@bitwarden/common/platform/services/default-environment.service";
@@ -822,7 +821,7 @@ const safeProviders: SafeProvider[] = [
}),
safeProvider({
provide: EncryptService,
useFactory: encryptServiceFactory,
useClass: MultithreadEncryptServiceImplementation,
deps: [CryptoFunctionServiceAbstraction, LogService, LOG_MAC_FAILURES],
}),
safeProvider({
@@ -1242,16 +1241,6 @@ const safeProviders: SafeProvider[] = [
}),
];
function encryptServiceFactory(
cryptoFunctionservice: CryptoFunctionServiceAbstraction,
logService: LogService,
logMacFailures: boolean,
): EncryptService {
return flagEnabled("multithreadDecryption")
? new MultithreadEncryptServiceImplementation(cryptoFunctionservice, logService, logMacFailures)
: new EncryptServiceImplementation(cryptoFunctionservice, logService, logMacFailures);
}
@NgModule({
declarations: [],
// Do not register your dependency here! Add it to the typesafeProviders array using the helper function