forked from sim0n00ps/OF-DL
46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using OF_DL.Models;
|
|
using UserEntities = OF_DL.Models.Entities.Users;
|
|
|
|
namespace OF_DL.Services;
|
|
|
|
public interface IAuthService
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the current authentication state.
|
|
/// </summary>
|
|
Auth? CurrentAuth { get; set; }
|
|
|
|
/// <summary>
|
|
/// Loads authentication data from the disk.
|
|
/// </summary>
|
|
Task<bool> LoadFromFileAsync(string filePath = "auth.json");
|
|
|
|
/// <summary>
|
|
/// Launches a browser session and extracts auth data after login.
|
|
/// </summary>
|
|
/// <param name="statusCallback">
|
|
/// Optional callback for reporting status messages to be displayed in the UI.
|
|
/// </param>
|
|
Task<bool> LoadFromBrowserAsync(Action<string>? statusCallback = null);
|
|
|
|
/// <summary>
|
|
/// Persists the current auth data to disk.
|
|
/// </summary>
|
|
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 chromium-data and auth.json.
|
|
/// </summary>
|
|
void Logout();
|
|
}
|