From a456e7e33032ae277f3d58c0e7f32b3e019c01d6 Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Mon, 3 Nov 2025 15:15:38 +0100 Subject: [PATCH] Fix min and default values in kdf migration --- .../encrypted-migrator/migrations/minimum-kdf-migration.spec.ts | 2 +- .../encrypted-migrator/migrations/minimum-kdf-migration.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/common/src/key-management/encrypted-migrator/migrations/minimum-kdf-migration.spec.ts b/libs/common/src/key-management/encrypted-migrator/migrations/minimum-kdf-migration.spec.ts index 57e37568ca5..cf2bd307b6c 100644 --- a/libs/common/src/key-management/encrypted-migrator/migrations/minimum-kdf-migration.spec.ts +++ b/libs/common/src/key-management/encrypted-migrator/migrations/minimum-kdf-migration.spec.ts @@ -140,7 +140,7 @@ describe("MinimumKdfMigration", () => { // Verify the PBKDF2KdfConfig has the correct iteration count const kdfConfigArg = (mockChangeKdfService.updateUserKdfParams as jest.Mock).mock.calls[0][1]; - expect(kdfConfigArg.iterations).toBe(PBKDF2KdfConfig.ITERATIONS.min); + expect(kdfConfigArg.iterations).toBe(PBKDF2KdfConfig.ITERATIONS.defaultValue); }); it("should throw error when userId is null", async () => { diff --git a/libs/common/src/key-management/encrypted-migrator/migrations/minimum-kdf-migration.ts b/libs/common/src/key-management/encrypted-migrator/migrations/minimum-kdf-migration.ts index b6dc9b78394..0666064b36e 100644 --- a/libs/common/src/key-management/encrypted-migrator/migrations/minimum-kdf-migration.ts +++ b/libs/common/src/key-management/encrypted-migrator/migrations/minimum-kdf-migration.ts @@ -54,7 +54,7 @@ export class MinimumKdfMigration implements EncryptedMigration { const kdfConfig = await this.kdfConfigService.getKdfConfig(userId); if ( kdfConfig.kdfType !== KdfType.PBKDF2_SHA256 || - kdfConfig.iterations >= PBKDF2KdfConfig.ITERATIONS.defaultValue + kdfConfig.iterations >= PBKDF2KdfConfig.ITERATIONS.min ) { return "noMigrationNeeded"; }