using Tiku.Domain.Tenancy; namespace Tiku.Application.Auth; public interface IAuthSessionStore { string GenerateRefreshToken(AuthRealm realm, Guid? tenantId, Guid sessionId); bool TryParseRefreshToken(string refreshToken, out RefreshTokenLocator locator); string HashRefreshToken(string refreshToken); Task IssueAsync( AuthSessionIssueRequest request, CancellationToken cancellationToken = default); Task RotateAsync( string refreshToken, string? ipAddress, string? userAgent, CancellationToken cancellationToken = default); Task ValidateAccessSessionAsync( Guid sessionId, Guid userId, AuthRealm realm, Guid? tenantId, CancellationToken cancellationToken = default); Task RevokeFamilyAsync(string refreshToken, string reason, CancellationToken cancellationToken = default); Task RevokeRealmAsync(Guid userId, AuthRealm realm, Guid? tenantId, string reason, CancellationToken cancellationToken = default); Task RevokeAllAsync(Guid userId, string reason, CancellationToken cancellationToken = default); } public sealed record AuthSessionIssueRequest( Guid UserId, string? Phone, string? Email, string SecurityStamp, AuthRealm Realm, Guid? TenantId, string Provider, bool MfaSatisfied, string? IpAddress, string? UserAgent, Guid? TokenFamilyId = null, Guid? ParentSessionId = null); public sealed record AuthSessionValidationResult(Guid UserId, AuthRealm Realm, Guid? TenantId, bool MfaSatisfied); public readonly record struct RefreshTokenLocator(AuthRealm Realm, Guid? TenantId, Guid SessionId);