1
0
mirror of https://github.com/bitwarden/server synced 2026-01-03 09:03:44 +00:00

Added MasterPasswordUnlock to UserDecryptionOptions as part of identity response (#6093)

This commit is contained in:
Maciej Zieniuk
2025-07-28 17:34:42 +02:00
committed by GitHub
parent d407c164b6
commit 59e7bc7438
7 changed files with 247 additions and 27 deletions

View File

@@ -1,8 +1,7 @@
using System.Text.Json.Serialization;
using Bit.Core.KeyManagement.Models.Response;
using Bit.Core.Models.Api;
#nullable enable
namespace Bit.Core.Auth.Models.Api.Response;
public class UserDecryptionOptions : ResponseModel
@@ -14,8 +13,15 @@ public class UserDecryptionOptions : ResponseModel
/// <summary>
/// Gets or sets whether the current user has a master password that can be used to decrypt their vault.
/// </summary>
[Obsolete("Use MasterPasswordUnlock instead. This will be removed in a future version.")]
public bool HasMasterPassword { get; set; }
/// <summary>
/// Gets or sets whether the current user has master password unlock data available.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public MasterPasswordUnlockResponseModel? MasterPasswordUnlock { get; set; }
/// <summary>
/// Gets or sets the WebAuthn PRF decryption keys.
/// </summary>

View File

@@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
using Bit.Core.Enums;
using Bit.Core.Utilities;
namespace Bit.Core.KeyManagement.Models.Response;
public class MasterPasswordUnlockResponseModel
{
public required MasterPasswordUnlockKdfResponseModel Kdf { get; init; }
[EncryptedString] public required string MasterKeyEncryptedUserKey { get; init; }
[StringLength(256)] public required string Salt { get; init; }
}
public class MasterPasswordUnlockKdfResponseModel
{
public required KdfType KdfType { get; init; }
public required int Iterations { get; init; }
public int? Memory { get; init; }
public int? Parallelism { get; init; }
}