/** * Session Sharing (GAP-009) * * Enables cross-domain session sharing for SSO-authenticated domains. * When a user authenticates via SSO on one domain, their session can be * shared with other domains that use the same identity provider. * * Key features: * - Detects SSO flows during browsing * - Correlates domains by identity provider * - Shares session data across related domains * - Validates session before sharing (to avoid stale credentials) */ import type { SessionManager, SessionHealth } from './session-manager.js'; import { type SSOFlowInfo, type SSODetectorOptions } from './sso-flow-detector.js'; import { type DomainGroup, type CorrelatorState } from './domain-correlator.js'; /** * Result of attempting to share a session */ export interface SessionShareResult { success: boolean; sourceDomain: string; targetDomain: string; providerId?: string; /** What was shared (cookies, localStorage, etc.) */ sharedItems?: string[]; /** Why sharing failed (if applicable) */ error?: string; /** Confidence in the shared session working */ confidence?: number; } /** * A candidate domain from which to borrow a session */ export interface SessionCandidate { domain: string; providerId: string; confidence: number; sessionHealth?: SessionHealth; lastUsed?: number; } /** * Options for session sharing */ export interface SessionSharingOptions { /** Minimum confidence required to share a session */ minConfidence?: number; /** Include localStorage in sharing */ shareLocalStorage?: boolean; /** Include sessionStorage in sharing */ shareSessionStorage?: boolean; /** Only share IdP-related cookies (vs all cookies) */ filterCookies?: boolean; /** Profile to use for sessions */ sessionProfile?: string; } /** * Configuration for the SessionSharingService */ export interface SessionSharingConfig { ssoDetectorOptions?: SSODetectorOptions; defaultSharingOptions?: SessionSharingOptions; } export declare class SessionSharingService { private sessionManager; private ssoDetector; private correlator; private config; private defaultOptions; constructor(sessionManager: SessionManager, config?: SessionSharingConfig); /** * Process a URL for SSO flow detection * Call this when navigating to capture SSO flows */ processUrl(url: string, initiatingDomain?: string): SSOFlowInfo | null; /** * Process page content for social login detection */ processContent(html: string, currentDomain: string): SSOFlowInfo[]; /** * Find domains that could share a session with the target domain */ findSessionCandidates(targetDomain: string, options?: SessionSharingOptions): Promise; /** * Attempt to get a usable session for the target domain by checking related domains */ getOrShareSession(targetDomain: string, options?: SessionSharingOptions): Promise; /** * Share session from source domain to target domain */ shareSession(sourceDomain: string, targetDomain: string, options?: SessionSharingOptions): Promise; /** * Save a shared session (internal method) * Uses the SessionManager's saveSessionData method */ private saveSharedSession; /** * Get domain groups for debugging/inspection */ getDomainGroups(minConfidence?: number): DomainGroup[]; /** * Get related domains for a specific domain */ getRelatedDomains(domain: string, minConfidence?: number): string[]; /** * Export state for persistence */ exportState(): CorrelatorState; /** * Import state from persistence */ importState(state: CorrelatorState): void; /** * Apply confidence decay to old relationships */ applyDecay(): number; /** * Get statistics about domain correlations */ getStats(): import("./domain-correlator.js").CorrelationStats; /** * Clean up stale SSO flows */ cleanupFlows(maxAgeMs?: number): number; } //# sourceMappingURL=session-sharing.d.ts.map