mirror of
https://github.com/bitwarden/server
synced 2026-02-24 08:33:06 +00:00
This reverts commit 8cb8030534.
This commit is contained in:
committed by
GitHub
parent
8cb8030534
commit
029a5f6a2d
@@ -1,33 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.KeyManagement.Models.Data;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.KeyManagement.Models.Api.Request;
|
||||
|
||||
public class KdfRequestModel : IValidatableObject
|
||||
{
|
||||
[Required]
|
||||
public required KdfType KdfType { get; init; }
|
||||
[Required]
|
||||
public required int Iterations { get; init; }
|
||||
public int? Memory { get; init; }
|
||||
public int? Parallelism { get; init; }
|
||||
|
||||
public KdfSettings ToData()
|
||||
{
|
||||
return new KdfSettings
|
||||
{
|
||||
KdfType = KdfType,
|
||||
Iterations = Iterations,
|
||||
Memory = Memory,
|
||||
Parallelism = Parallelism
|
||||
};
|
||||
}
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
// Generic per-request KDF validation for any request model embedding KdfRequestModel
|
||||
return KdfSettingsValidator.Validate(ToData());
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.KeyManagement.Models.Data;
|
||||
|
||||
namespace Bit.Core.KeyManagement.Models.Api.Request;
|
||||
|
||||
/// <summary>
|
||||
/// Use this datatype when interfacing with requests to create a separation of concern.
|
||||
/// See <see cref="MasterPasswordAuthenticationData"/> to use for commands, queries, services.
|
||||
/// </summary>
|
||||
public class MasterPasswordAuthenticationDataRequestModel
|
||||
{
|
||||
public required KdfRequestModel Kdf { get; init; }
|
||||
[Required]
|
||||
public required string MasterPasswordAuthenticationHash { get; init; }
|
||||
[Required]
|
||||
[StringLength(256)]
|
||||
public required string Salt { get; init; }
|
||||
|
||||
public MasterPasswordAuthenticationData ToData()
|
||||
{
|
||||
return new MasterPasswordAuthenticationData
|
||||
{
|
||||
Kdf = Kdf.ToData(),
|
||||
MasterPasswordAuthenticationHash = MasterPasswordAuthenticationHash,
|
||||
Salt = Salt
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.KeyManagement.Models.Data;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.KeyManagement.Models.Api.Request;
|
||||
|
||||
/// <summary>
|
||||
/// Use this datatype when interfacing with requests to create a separation of concern.
|
||||
/// See <see cref="MasterPasswordUnlockData"/> to use for commands, queries, services.
|
||||
/// </summary>
|
||||
public class MasterPasswordUnlockDataRequestModel
|
||||
{
|
||||
public required KdfRequestModel Kdf { get; init; }
|
||||
[Required]
|
||||
[EncryptedString]
|
||||
public required string MasterKeyWrappedUserKey { get; init; }
|
||||
[Required]
|
||||
[StringLength(256)]
|
||||
public required string Salt { get; init; }
|
||||
|
||||
public MasterPasswordUnlockData ToData()
|
||||
{
|
||||
return new MasterPasswordUnlockData
|
||||
{
|
||||
Kdf = Kdf.ToData(),
|
||||
MasterKeyWrappedUserKey = MasterKeyWrappedUserKey,
|
||||
Salt = Salt
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,8 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.KeyManagement.Models.Api.Request;
|
||||
|
||||
namespace Bit.Core.KeyManagement.Models.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Use this datatype when interfacing with commands, queries, services to create a separation of concern.
|
||||
/// See <see cref="MasterPasswordAuthenticationDataRequestModel"/> to use for requests.
|
||||
/// </summary>
|
||||
public class MasterPasswordAuthenticationData
|
||||
{
|
||||
public required KdfSettings Kdf { get; init; }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Bit.Core.Entities;
|
||||
#nullable enable
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
|
||||
namespace Bit.Core.KeyManagement.Models.Data;
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.KeyManagement.Models.Api.Request;
|
||||
|
||||
namespace Bit.Core.KeyManagement.Models.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Use this datatype when interfacing with commands, queries, services to create a separation of concern.
|
||||
/// See <see cref="MasterPasswordUnlockDataRequestModel"/> to use for requests.
|
||||
/// </summary>
|
||||
public class MasterPasswordUnlockData
|
||||
{
|
||||
public required KdfSettings Kdf { get; init; }
|
||||
|
||||
Reference in New Issue
Block a user