FruitBankHybridApp/FruitBank.Common/Services/ISecureCredentialService.cs

30 lines
938 B
C#

namespace FruitBank.Common.Services;
/// <summary>
/// Service for securely storing and retrieving user credentials.
/// Platform-specific implementations handle the actual secure storage.
/// </summary>
public interface ISecureCredentialService
{
/// <summary>
/// Saves the user credentials securely with a 2-day expiration from now.
/// </summary>
Task SaveCredentialsAsync(string email, string password);
/// <summary>
/// Retrieves the stored credentials if they exist and haven't expired.
/// Returns null if no credentials are stored or if they have expired.
/// </summary>
Task<StoredCredentials?> GetCredentialsAsync();
/// <summary>
/// Clears all stored credentials (used on logout).
/// </summary>
Task ClearCredentialsAsync();
}
/// <summary>
/// Represents stored user credentials.
/// </summary>
public sealed record StoredCredentials(string Email, string Password);