From 18c562db6f1a51bb9b00be76f3a18e0ddddf5241 Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Mon, 9 Jun 2025 14:41:04 +0200 Subject: [PATCH] Fix tests --- .../UserKey/Implementations/RotateUserAccountkeysCommand.cs | 2 +- .../UserKey/RotateUserAccountKeysCommandTests.cs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs b/src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs index d30db6fa77..3b2f7ea8bd 100644 --- a/src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs +++ b/src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs @@ -159,7 +159,7 @@ public class RotateUserAccountKeysCommand( { await ValidateRotationModelSignatureKeyPairForV2User(model, user); } - else + else if (model.AccountKeys.SignatureKeyPairData != null) { ValidateRotationModelSignatureKeyPairForV1UserAndUpgradeToV2(model, user, saveEncryptedDataActions); } diff --git a/test/Core.Test/KeyManagement/UserKey/RotateUserAccountKeysCommandTests.cs b/test/Core.Test/KeyManagement/UserKey/RotateUserAccountKeysCommandTests.cs index bb2637e2db..f6c3a78712 100644 --- a/test/Core.Test/KeyManagement/UserKey/RotateUserAccountKeysCommandTests.cs +++ b/test/Core.Test/KeyManagement/UserKey/RotateUserAccountKeysCommandTests.cs @@ -112,13 +112,15 @@ public class RotateUserAccountKeysCommandTests } [Theory, BitAutoData] - public async Task RotatesCorrectly(SutProvider sutProvider, User user, + public async Task RotatesCorrectlyV1Async(SutProvider sutProvider, User user, RotateUserAccountKeysData model) { user.Kdf = Enums.KdfType.Argon2id; user.KdfIterations = 3; user.KdfMemory = 64; user.KdfParallelism = 4; + user.PrivateKey = "2.xxx"; + user.SignedPublicKey = null; model.MasterPasswordUnlockData.Email = user.Email; model.MasterPasswordUnlockData.KdfType = Enums.KdfType.Argon2id; @@ -127,6 +129,8 @@ public class RotateUserAccountKeysCommandTests model.MasterPasswordUnlockData.KdfParallelism = 4; model.AccountPublicKey = user.PublicKey; + model.UserKeyEncryptedAccountPrivateKey = "2.xxx"; + model.AccountKeys.SignatureKeyPairData = null; sutProvider.GetDependency().CheckPasswordAsync(user, model.OldMasterKeyAuthenticationHash) .Returns(true);