mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 09:33:13 +00:00
30 lines
1.5 KiB
C#
30 lines
1.5 KiB
C#
using Data.SeaHavenIndustries;
|
|
|
|
namespace SeaHaven.DataServices.Interfaces
|
|
{
|
|
public interface IForgetPasswordDataService
|
|
{
|
|
/// <summary>Deletes every pending code for the email, then stores the new one.</summary>
|
|
Task ReplaceCodeAsync(string email, string userId, string codeHash, string codeSalt, DateTime expiresAtUtc, CancellationToken cancellationToken);
|
|
|
|
/// <summary>Returns the pending code for exactly this email, or null.</summary>
|
|
Task<ForgetPasswordCode?> GetByEmailAsync(string email, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Atomically consumes one attempt when the code is unexpired and has fewer
|
|
/// than <paramref name="maxAttempts"/> consumed. Returns false otherwise.
|
|
/// </summary>
|
|
Task<bool> TryConsumeAttemptAsync(int id, int maxAttempts, DateTime nowUtc, CancellationToken cancellationToken);
|
|
|
|
/// <summary>Gives back an attempt consumed by a check that matched.</summary>
|
|
Task RefundAttemptAsync(int id, CancellationToken cancellationToken);
|
|
|
|
Task RemoveByEmailAsync(string email, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Deletes the email's codes issued up to and including <paramref name="throughId"/>,
|
|
/// leaving any code issued after it by a concurrent request.
|
|
/// </summary>
|
|
Task RemoveIssuedThroughAsync(string email, int throughId, CancellationToken cancellationToken);
|
|
}
|
|
}
|