mirror of
https://github.com/bitwarden/server
synced 2026-01-29 15:53:36 +00:00
MAYBE: Use KM owned ResponseModel?
This commit is contained in:
@@ -18,7 +18,6 @@ using Bit.Core.Vault.Entities;
|
||||
using Bit.Core.Vault.Models.Data;
|
||||
using Bit.Core.Auth.Entities;
|
||||
using Bit.Core.Auth.Enums;
|
||||
using Bit.Core.Auth.Models.Api.Response;
|
||||
|
||||
namespace Bit.Api.Vault.Models.Response;
|
||||
|
||||
@@ -61,7 +60,7 @@ public class SyncResponseModel() : ResponseModel("sync")
|
||||
Sends = sends.Select(s => new SendResponseModel(s, globalSettings));
|
||||
var webAuthnPrfOptions = webAuthnCredentials
|
||||
.Where(c => c.GetPrfStatus() == WebAuthnPrfStatus.Enabled)
|
||||
.Select(c => new WebAuthnPrfDecryptionOption(
|
||||
.Select(c => new WebAuthnPrfKeyManagementResponseModel(
|
||||
c.EncryptedPrivateKey,
|
||||
c.EncryptedUserKey,
|
||||
c.CredentialId,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Bit.Core.Auth.Models.Api.Response;
|
||||
|
||||
namespace Bit.Core.KeyManagement.Models.Response;
|
||||
|
||||
@@ -14,5 +13,5 @@ public class UserDecryptionResponseModel
|
||||
/// Gets or sets the WebAuthn PRF decryption keys.
|
||||
/// </summary>
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public WebAuthnPrfDecryptionOption[]? WebAuthnPrfOptions { get; set; }
|
||||
public WebAuthnPrfKeyManagementResponseModel[]? WebAuthnPrfOptions { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace Bit.Core.KeyManagement.Models.Response;
|
||||
|
||||
/// <summary>
|
||||
/// Response model for WebAuthn PRF decryption options used in key management contexts.
|
||||
/// This mirrors WebAuthnPrfDecryptionOption from Auth namespace but belongs to KeyManagement.
|
||||
/// </summary>
|
||||
public class WebAuthnPrfKeyManagementResponseModel
|
||||
{
|
||||
public string EncryptedPrivateKey { get; }
|
||||
public string EncryptedUserKey { get; }
|
||||
public string CredentialId { get; }
|
||||
public string[] Transports { get; }
|
||||
|
||||
public WebAuthnPrfKeyManagementResponseModel(
|
||||
string encryptedPrivateKey,
|
||||
string encryptedUserKey,
|
||||
string credentialId,
|
||||
string[] transports)
|
||||
{
|
||||
EncryptedPrivateKey = encryptedPrivateKey;
|
||||
EncryptedUserKey = encryptedUserKey;
|
||||
CredentialId = credentialId;
|
||||
Transports = transports;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user