UNPKG

@surgbc/egw-writings-shared

Version:

Shared utilities, types, and database schema for EGW Writings MCP servers

69 lines (68 loc) 1.64 kB
export interface OAuthConfig { clientId: string; clientSecret: string; redirectUri: string; scope: string; authBaseUrl: string; apiBaseUrl: string; } export interface TokenResponse { access_token: string; refresh_token?: string; token_type: string; expires_in: number; scope: string; } export interface TokenInfo { accessToken: string; refreshToken?: string; expiresAt: number; scope: string; } export declare class EGWAuthManager { private config; private tokenFile; private currentToken; constructor(config: OAuthConfig, tokenFile?: string); /** * Generate OAuth authorization URL for interactive auth */ getAuthorizationUrl(state?: string): string; /** * Exchange authorization code for access token */ exchangeCodeForToken(code: string): Promise<TokenInfo>; /** * Get valid access token (refresh if needed) */ getValidToken(): Promise<string>; /** * Refresh access token using refresh token */ refreshToken(): Promise<TokenInfo>; /** * Authenticate using client credentials flow */ clientCredentialsAuth(): Promise<TokenInfo>; /** * Save token to file */ private saveToken; /** * Load token from file */ private loadToken; /** * Clear saved token */ clearToken(): Promise<void>; /** * Check if authenticated */ isAuthenticated(): Promise<boolean>; /** * Get token info for debugging */ getTokenInfo(): TokenInfo | null; } export declare const createAuthManager: () => EGWAuthManager;