1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 17:53:39 +00:00

[PM-5269] Key Connector state migration (#8327)

* key connector migration initial

* migrator complete

* fix dependencies

* finalized tests

* fix deps and sync main

* clean up definition file

* fixing tests

* fixed tests

* fixing CLI, Browser, Desktop builds

* fixed factory options

* reverting exports

* implemented UserKeyDefinition clearOn

* Update KeyConnector MIgration

* updated migrator and tests to match profile object

* removed unused service and updated clear

* dep fix

* dep fixes

* clear usesKeyConnector on logout
This commit is contained in:
Ike
2024-03-28 09:50:24 -07:00
committed by GitHub
parent df058ba399
commit 3d19e3489c
17 changed files with 691 additions and 72 deletions

View File

@@ -27,9 +27,9 @@ import {
LogServiceInitOptions,
} from "../../../platform/background/service-factories/log-service.factory";
import {
stateServiceFactory,
StateServiceInitOptions,
} from "../../../platform/background/service-factories/state-service.factory";
stateProviderFactory,
StateProviderInitOptions,
} from "../../../platform/background/service-factories/state-provider.factory";
import { TokenServiceInitOptions, tokenServiceFactory } from "./token-service.factory";
@@ -40,13 +40,13 @@ type KeyConnectorServiceFactoryOptions = FactoryOptions & {
};
export type KeyConnectorServiceInitOptions = KeyConnectorServiceFactoryOptions &
StateServiceInitOptions &
CryptoServiceInitOptions &
ApiServiceInitOptions &
TokenServiceInitOptions &
LogServiceInitOptions &
OrganizationServiceInitOptions &
KeyGenerationServiceInitOptions;
KeyGenerationServiceInitOptions &
StateProviderInitOptions;
export function keyConnectorServiceFactory(
cache: { keyConnectorService?: AbstractKeyConnectorService } & CachedServices,
@@ -58,7 +58,6 @@ export function keyConnectorServiceFactory(
opts,
async () =>
new KeyConnectorService(
await stateServiceFactory(cache, opts),
await cryptoServiceFactory(cache, opts),
await apiServiceFactory(cache, opts),
await tokenServiceFactory(cache, opts),
@@ -66,6 +65,7 @@ export function keyConnectorServiceFactory(
await organizationServiceFactory(cache, opts),
await keyGenerationServiceFactory(cache, opts),
opts.keyConnectorServiceOptions.logoutCallback,
await stateProviderFactory(cache, opts),
),
);
}

View File

@@ -30,6 +30,7 @@ import {
authServiceFactory,
AuthServiceInitOptions,
} from "../../auth/background/service-factories/auth-service.factory";
import { KeyConnectorServiceInitOptions } from "../../auth/background/service-factories/key-connector-service.factory";
import { userVerificationServiceFactory } from "../../auth/background/service-factories/user-verification-service.factory";
import { openUnlockPopout } from "../../auth/popup/utils/auth-popout-window";
import { autofillSettingsServiceFactory } from "../../autofill/background/service_factories/autofill-settings-service.factory";
@@ -78,7 +79,9 @@ export class ContextMenuClickedHandler {
static async mv3Create(cachedServices: CachedServices) {
const stateFactory = new StateFactory(GlobalState, Account);
const serviceOptions: AuthServiceInitOptions & CipherServiceInitOptions = {
const serviceOptions: AuthServiceInitOptions &
CipherServiceInitOptions &
KeyConnectorServiceInitOptions = {
apiServiceOptions: {
logoutCallback: NOT_IMPLEMENTED,
},

View File

@@ -514,7 +514,6 @@ export default class MainBackground {
this.badgeSettingsService = new BadgeSettingsService(this.stateProvider);
this.policyApiService = new PolicyApiService(this.policyService, this.apiService);
this.keyConnectorService = new KeyConnectorService(
this.stateService,
this.cryptoService,
this.apiService,
this.tokenService,
@@ -522,6 +521,7 @@ export default class MainBackground {
this.organizationService,
this.keyGenerationService,
logoutCallback,
this.stateProvider,
);
this.passwordStrengthService = new PasswordStrengthService();
@@ -1125,7 +1125,6 @@ export default class MainBackground {
this.policyService.clear(userId),
this.passwordGenerationService.clear(userId),
this.vaultTimeoutSettingsService.clear(userId),
this.keyConnectorService.clear(),
this.vaultFilterService.clear(),
this.biometricStateService.logout(userId),
this.providerService.save(null, userId),