PlotDirector/PlotLine/Services/AuthServiceInterfaces.cs
2026-06-06 17:21:58 +01:00

47 lines
1.4 KiB
C#

using PlotLine.ViewModels;
namespace PlotLine.Services;
public interface IAuthService
{
Task<bool> RegisterAsync(RegisterViewModel model);
Task<bool> LoginAsync(LoginViewModel model);
Task<bool> CompleteTwoFactorLoginAsync(TwoFactorViewModel model);
Task LogoutAsync();
Task<bool> VerifyEmailAsync(Guid token);
Task<bool> ForgotPasswordAsync(ForgotPasswordViewModel model);
Task<bool> ResetPasswordAsync(ResetPasswordViewModel model);
Task<bool> ChangePasswordAsync(ChangePasswordViewModel model);
Task<bool> EnableTwoFactorAsync(int userId);
Task<bool> DisableTwoFactorAsync(int userId);
Task<IReadOnlyList<string>> GenerateRecoveryCodesAsync(int userId);
}
public interface IPasswordService
{
string HashPassword(string password);
bool VerifyPassword(string password, string passwordHash);
}
public interface ITwoFactorService
{
string GenerateSecretKey();
string GenerateQrCodeUri(string email, string secretKey);
bool ValidateCode(string secretKey, string code);
IReadOnlyList<string> GenerateRecoveryCodes(int count);
}
public interface IEmailService
{
Task SendVerificationEmailAsync(string email, string displayName, Guid token);
Task SendPasswordResetEmailAsync(string email, string displayName, Guid token);
}
public interface ICurrentUserService
{
int? UserId { get; }
string? Email { get; }
string? DisplayName { get; }
bool IsAuthenticated { get; }
}