1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

[PM-19287] Feature flag for encrypt service (#13894)

* Extract getFeatureFlagValue to pure function

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>

* Add broadcasting abstractions and OnServerConfigChange interface.

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>

* Add implementation of onServerConfigChange on encrypt services

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>

* Add onServerConfigChange implementation for encrypt worker

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>

* Wire up broadcasting in dependency injection

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>

* Add unit tests

* Handle subscribing for onServerConfigChange in init services

---------

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
This commit is contained in:
Thomas Avery
2025-04-01 14:14:00 -05:00
committed by GitHub
parent fa0a7af8ed
commit 17f661e3d1
20 changed files with 722 additions and 58 deletions

View File

@@ -283,6 +283,7 @@ export class ServiceContainer {
cipherAuthorizationService: CipherAuthorizationService;
ssoUrlService: SsoUrlService;
masterPasswordApiService: MasterPasswordApiServiceAbstraction;
bulkEncryptService: FallbackBulkEncryptService;
constructor() {
let p = null;
@@ -314,6 +315,7 @@ export class ServiceContainer {
this.logService,
true,
);
this.bulkEncryptService = new FallbackBulkEncryptService(this.encryptService);
this.storageService = new LowdbStorageService(this.logService, null, p, false, true);
this.secureStorageService = new NodeEnvSecureStorageService(
this.storageService,
@@ -686,7 +688,7 @@ export class ServiceContainer {
this.stateService,
this.autofillSettingsService,
this.encryptService,
new FallbackBulkEncryptService(this.encryptService),
this.bulkEncryptService,
this.cipherFileUploadService,
this.configService,
this.stateProvider,
@@ -885,6 +887,12 @@ export class ServiceContainer {
await this.sdkLoadService.loadAndInit();
await this.storageService.init();
await this.stateService.init();
this.configService.serverConfig$.subscribe((newConfig) => {
if (newConfig != null) {
this.encryptService.onServerConfigChange(newConfig);
this.bulkEncryptService.onServerConfigChange(newConfig);
}
});
this.containerService.attachToGlobal(global);
await this.i18nService.init();
this.twoFactorService.init();