1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-20 02:48:03 -05:00

Fix cases for request data conversion

This commit is contained in:
Bernd Schoolmann 2025-06-16 11:32:00 +02:00
parent 54aac8cfc4
commit dbb4aca1e2
No known key found for this signature in database

View File

@ -15,7 +15,7 @@ public class AccountKeysRequestModel
public UserAccountKeysData ToAccountKeysData() public UserAccountKeysData ToAccountKeysData()
{ {
// This will be cleaned up, after a compatibility period, at which point PublicKeyEncryptionKeyPair and SignatureKeyPair will be required. // This will be cleaned up, after a compatibility period, at which point PublicKeyEncryptionKeyPair and SignatureKeyPair will be required.
if (PublicKeyEncryptionKeyPair == null || SignatureKeyPair == null) if (PublicKeyEncryptionKeyPair == null)
{ {
return new UserAccountKeysData return new UserAccountKeysData
{ {
@ -28,11 +28,21 @@ public class AccountKeysRequestModel
} }
else else
{ {
return new UserAccountKeysData if (SignatureKeyPair == null)
{ {
PublicKeyEncryptionKeyPairData = PublicKeyEncryptionKeyPair.ToPublicKeyEncryptionKeyPairData(), return new UserAccountKeysData
SignatureKeyPairData = SignatureKeyPair.ToSignatureKeyPairData() {
}; PublicKeyEncryptionKeyPairData = PublicKeyEncryptionKeyPair.ToPublicKeyEncryptionKeyPairData(),
};
}
else
{
return new UserAccountKeysData
{
PublicKeyEncryptionKeyPairData = PublicKeyEncryptionKeyPair.ToPublicKeyEncryptionKeyPairData(),
SignatureKeyPairData = SignatureKeyPair.ToSignatureKeyPairData()
};
}
} }
} }
} }