mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 13:53:34 +00:00
[PM-27221] Update legacy kdf state on master password unlock sync (#16966)
* Update legacy kdf state on master password unlock sync * Fix cli build * Fix * Fix build * Fix cli * Fix browser
This commit is contained in:
@@ -1050,6 +1050,7 @@ export default class MainBackground {
|
|||||||
this.authService,
|
this.authService,
|
||||||
this.stateProvider,
|
this.stateProvider,
|
||||||
this.securityStateService,
|
this.securityStateService,
|
||||||
|
this.kdfConfigService,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.syncServiceListener = new SyncServiceListener(
|
this.syncServiceListener = new SyncServiceListener(
|
||||||
|
|||||||
@@ -846,6 +846,7 @@ export class ServiceContainer {
|
|||||||
this.authService,
|
this.authService,
|
||||||
this.stateProvider,
|
this.stateProvider,
|
||||||
this.securityStateService,
|
this.securityStateService,
|
||||||
|
this.kdfConfigService,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.totpService = new TotpService(this.sdkService);
|
this.totpService = new TotpService(this.sdkService);
|
||||||
|
|||||||
@@ -847,6 +847,7 @@ const safeProviders: SafeProvider[] = [
|
|||||||
AuthServiceAbstraction,
|
AuthServiceAbstraction,
|
||||||
StateProvider,
|
StateProvider,
|
||||||
SecurityStateService,
|
SecurityStateService,
|
||||||
|
KdfConfigService,
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
safeProvider({
|
safeProvider({
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { EncString } from "@bitwarden/common/key-management/crypto/models/enc-st
|
|||||||
import { SecurityStateService } from "@bitwarden/common/key-management/security-state/abstractions/security-state.service";
|
import { SecurityStateService } from "@bitwarden/common/key-management/security-state/abstractions/security-state.service";
|
||||||
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
|
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
|
||||||
// eslint-disable-next-line no-restricted-imports
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { KeyService, PBKDF2KdfConfig } from "@bitwarden/key-management";
|
import { KdfConfigService, KeyService, PBKDF2KdfConfig } from "@bitwarden/key-management";
|
||||||
|
|
||||||
import { Matrix } from "../../../spec/matrix";
|
import { Matrix } from "../../../spec/matrix";
|
||||||
import { ApiService } from "../../abstractions/api.service";
|
import { ApiService } from "../../abstractions/api.service";
|
||||||
@@ -75,6 +75,7 @@ describe("DefaultSyncService", () => {
|
|||||||
let authService: MockProxy<AuthService>;
|
let authService: MockProxy<AuthService>;
|
||||||
let stateProvider: MockProxy<StateProvider>;
|
let stateProvider: MockProxy<StateProvider>;
|
||||||
let securityStateService: MockProxy<SecurityStateService>;
|
let securityStateService: MockProxy<SecurityStateService>;
|
||||||
|
let kdfConfigService: MockProxy<KdfConfigService>;
|
||||||
|
|
||||||
let sut: DefaultSyncService;
|
let sut: DefaultSyncService;
|
||||||
|
|
||||||
@@ -105,6 +106,7 @@ describe("DefaultSyncService", () => {
|
|||||||
authService = mock();
|
authService = mock();
|
||||||
stateProvider = mock();
|
stateProvider = mock();
|
||||||
securityStateService = mock();
|
securityStateService = mock();
|
||||||
|
kdfConfigService = mock();
|
||||||
|
|
||||||
sut = new DefaultSyncService(
|
sut = new DefaultSyncService(
|
||||||
masterPasswordAbstraction,
|
masterPasswordAbstraction,
|
||||||
@@ -132,6 +134,7 @@ describe("DefaultSyncService", () => {
|
|||||||
authService,
|
authService,
|
||||||
stateProvider,
|
stateProvider,
|
||||||
securityStateService,
|
securityStateService,
|
||||||
|
kdfConfigService,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
|
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
|
||||||
import { SecurityStateService } from "@bitwarden/common/key-management/security-state/abstractions/security-state.service";
|
import { SecurityStateService } from "@bitwarden/common/key-management/security-state/abstractions/security-state.service";
|
||||||
// eslint-disable-next-line no-restricted-imports
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { KeyService } from "@bitwarden/key-management";
|
import { KdfConfigService, KeyService } from "@bitwarden/key-management";
|
||||||
|
|
||||||
// FIXME: remove `src` and fix import
|
// FIXME: remove `src` and fix import
|
||||||
// eslint-disable-next-line no-restricted-imports
|
// eslint-disable-next-line no-restricted-imports
|
||||||
@@ -100,6 +100,7 @@ export class DefaultSyncService extends CoreSyncService {
|
|||||||
authService: AuthService,
|
authService: AuthService,
|
||||||
stateProvider: StateProvider,
|
stateProvider: StateProvider,
|
||||||
private securityStateService: SecurityStateService,
|
private securityStateService: SecurityStateService,
|
||||||
|
private kdfConfigService: KdfConfigService,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
tokenService,
|
tokenService,
|
||||||
@@ -434,6 +435,7 @@ export class DefaultSyncService extends CoreSyncService {
|
|||||||
masterPasswordUnlockData,
|
masterPasswordUnlockData,
|
||||||
userId,
|
userId,
|
||||||
);
|
);
|
||||||
|
await this.kdfConfigService.setKdfConfig(userId, masterPasswordUnlockData.kdf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user