using System;
using System.Threading;
using System.Threading.Tasks;
using CarpaNet.OAuth.Crypto;
namespace CarpaNet.OAuth.Storage;
///
/// Represents stored OAuth session data.
///
public sealed class OAuthSessionData
{
///
/// The DPoP key pair (serialized as JWK with private key).
///
public JsonWebKey DPoPKey { get; set; } = new();
///
/// The client authentication method used.
///
public string? AuthMethod { get; set; }
///
/// The token set.
///
public TokenSet TokenSet { get; set; } = new();
///
/// The OAuth client ID used for this session.
///
public string? ClientId { get; set; }
///
/// The OAuth redirect URI used for this session.
///
public string? RedirectUri { get; set; }
///
/// The OAuth scope used for this session.
///
public string? Scope { get; set; }
}
///
/// Storage for OAuth sessions (after successful authentication).
///
public interface IOAuthSessionStore
{
///
/// Stores a session for a user.
///
/// The user's DID (subject).
/// The session data.
/// Cancellation token.
Task StoreAsync(string sub, OAuthSessionData data, CancellationToken cancellationToken = default);
///
/// Retrieves a session for a user.
///
/// The user's DID (subject).
/// Cancellation token.
/// The session data if found, null otherwise.
Task GetAsync(string sub, CancellationToken cancellationToken = default);
///
/// Deletes a session for a user.
///
/// The user's DID (subject).
/// Cancellation token.
Task DeleteAsync(string sub, CancellationToken cancellationToken = default);
}