/** * Token Storage for OAuth 2.1 authentication * Provides implementations for storing OAuth tokens */ import type { OAuthTokens, TokenStorage } from "../../types/index.js"; /** * In-memory token storage implementation * Suitable for development and single-session use * Tokens are lost when the process terminates */ export declare class InMemoryTokenStorage implements TokenStorage { private tokens; getTokens(serverId: string): Promise; saveTokens(serverId: string, tokens: OAuthTokens): Promise; deleteTokens(serverId: string): Promise; hasTokens(serverId: string): Promise; clearAll(): Promise; /** * Get the number of stored token sets */ get size(): number; /** * Get all server IDs with stored tokens */ getServerIds(): string[]; } /** * File-based token storage implementation * Persists tokens to disk for cross-session use */ export declare class FileTokenStorage implements TokenStorage { private filePath; private tokens; private loaded; constructor(filePath: string); private loadTokens; private saveToFile; getTokens(serverId: string): Promise; saveTokens(serverId: string, tokens: OAuthTokens): Promise; deleteTokens(serverId: string): Promise; hasTokens(serverId: string): Promise; clearAll(): Promise; } /** * Check if tokens are expired or about to expire * @param tokens - OAuth tokens to check * @param bufferSeconds - Buffer time in seconds before expiration (default: 60) * @returns True if tokens are expired or will expire within buffer time */ export declare function isTokenExpired(tokens: OAuthTokens, bufferSeconds?: number): boolean; /** * Calculate token expiration timestamp from expires_in value * @param expiresIn - Token lifetime in seconds * @returns Expiration timestamp (Unix epoch in milliseconds) */ export declare function calculateExpiresAt(expiresIn: number): number;