OF-DL/OF DL.Core/Services/IAuthService.cs

31 lines
772 B
C#

using OF_DL.Models;
using UserEntities = OF_DL.Models.Entities.Users;
namespace OF_DL.Services;
public interface IAuthService
{
Auth? CurrentAuth { get; set; }
Task<bool> LoadFromFileAsync(string filePath = "auth.json");
Task<bool> LoadFromBrowserAsync();
Task SaveToFileAsync(string filePath = "auth.json");
/// <summary>
/// Cleans up the cookie string to only contain auth_id and sess cookies.
/// </summary>
void ValidateCookieString();
/// <summary>
/// Validates auth by calling the API and returns the user info if valid.
/// </summary>
Task<UserEntities.User?> ValidateAuthAsync();
/// <summary>
/// Logs out by deleting chrome-data and auth.json.
/// </summary>
void Logout();
}