using System.Diagnostics.CodeAnalysis; using OliverBooth.Data.Web; namespace OliverBooth.Services; /// /// Represents a service for managing users. /// public interface IUserService { /// /// Clears all expired tokens. /// void ClearExpiredTokens(); /// /// Clears all tokens. /// void ClearTokens(); /// /// Creates a temporary MFA token for the specified user. /// /// The user for whom to create the token. /// The newly-created token. /// is . IMfaToken CreateMfaToken(IUser user); /// /// Deletes the specified token. /// /// The token to delete. /// is . void DeleteToken(string token); /// /// Attempts to find a user with the specified ID. /// /// The ID of the user to find. /// /// When this method returns, contains the user with the specified ID, if the user is found; otherwise, /// . /// /// /// if a user with the specified ID is found; otherwise, . /// bool TryGetUser(Guid id, [NotNullWhen(true)] out IUser? user); /// /// Verifies the login information of the specified user. /// /// The email address. /// The password. /// /// When this method returns, contains the user associated with the login credentials, or /// if the credentials are invalid. /// /// /// if the login credentials are valid; otherwise, . /// bool VerifyLogin(string email, string password, [NotNullWhen(true)] out IUser? user); /// /// Verifies the MFA request for the specified user. /// /// The MFA token. /// The user-provided TOTP. /// /// When this method returns, contains the user associated with the specified token, if the verification was /// successful; otherwise, . /// /// /// An representing the result of the request. /// /// /// is . /// -or- /// is . /// MfaRequestResult VerifyMfaRequest(string token, string totp, out IUser? user); }