1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-28 08:12:22 -05:00
bitwarden/src/Api/Auth/Validators/IRotationValidator.cs
Jake Fink ca8e3f496e
[PM-3797 Part 4] Add Sends to new Key Rotation (#3442)
* add send validation

* add send repo methods

* add send rotation to delegate list

* add success test
2023-12-12 11:58:34 -05:00

23 lines
834 B
C#

using Bit.Core.Entities;
using Bit.Core.Exceptions;
namespace Bit.Api.Auth.Validators;
/// <summary>
/// A consistent interface for domains to validate re-encrypted data before saved to database. Some examples are:<br/>
/// - All available encrypted data is accounted for<br/>
/// - All provided encrypted data belongs to the user
/// </summary>
/// <typeparam name="T">Request model</typeparam>
/// <typeparam name="R">Domain model</typeparam>
public interface IRotationValidator<T, R>
{
/// <summary>
/// Validates re-encrypted data before being saved to database.
/// </summary>
/// <param name="user">Request model</param>
/// <param name="data">Domain model</param>
/// <exception cref="BadRequestException">Throws if data fails validation</exception>
Task<R> ValidateAsync(User user, T data);
}