1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-20 02:48:03 -05:00
This commit is contained in:
Bernd Schoolmann 2025-06-05 14:21:04 +02:00
parent 90ef67b05c
commit ccf1ffa90f
No known key found for this signature in database
2 changed files with 21 additions and 10 deletions

View File

@ -1,23 +1,34 @@
using Bit.Core.Models.Api; using Bit.Core.KeyManagement.Models.Data;
using Bit.Core.Models.Api;
namespace Bit.Api.KeyManagement.Models.Response; namespace Bit.Api.KeyManagement.Models.Response;
#nullable enable
/// <summary> /// <summary>
/// This response model is used to return the public keys of a user, to any other registered user or entity on the server. /// This response model is used to return the public keys of a user, to any other registered user or entity on the server.
/// It can contain public keys (signature/encryption), and proofs between the two. It does not contain (encrypted) private keys. /// It can contain public keys (signature/encryption), and proofs between the two. It does not contain (encrypted) private keys.
/// </summary> /// </summary>
public class PublicKeysResponseModel : ResponseModel public class PublicKeysResponseModel : ResponseModel
{ {
public PublicKeysResponseModel(string verifyingKey, string publicKey, string signedPublicKey) public PublicKeysResponseModel(UserAccountKeysData accountKeys)
: base("publicKeys") : base("publicKeys")
{ {
VerifyingKey = verifyingKey; if (accountKeys == null)
SignedPublicKey = signedPublicKey; {
PublicKey = publicKey; throw new ArgumentNullException(nameof(accountKeys));
}
if (accountKeys.SignatureKeyPairData != null)
{
SignedPublicKey = accountKeys.PublicKeyEncryptionKeyPairData.SignedPublicKey;
VerifyingKey = accountKeys.SignatureKeyPairData.VerifyingKey;
}
PublicKey = accountKeys.PublicKeyEncryptionKeyPairData.PublicKey;
} }
public string VerifyingKey { get; set; } public string? VerifyingKey { get; set; }
public string SignedPublicKey { get; set; } public string? SignedPublicKey { get; set; }
[System.Obsolete("Use SignedPublicKey for new code.")] [System.Obsolete("Use SignedPublicKey for new code, if it is not null.")]
public string PublicKey { get; set; } public required string PublicKey { get; set; }
} }

View File

@ -4,6 +4,6 @@ public class PublicKeyEncryptionKeyPairData
{ {
public string WrappedPrivateKey { get; set; } public string WrappedPrivateKey { get; set; }
public string SignedPublicKey { get; set; } public string SignedPublicKey { get; set; }
[System.Obsolete("Use SignedPublicKey instead for new code.")] [System.Obsolete("Use SignedPublicKey instead for new code, if it is not null.")]
public string PublicKey { get; set; } public string PublicKey { get; set; }
} }