import { CredentialManager } from "./credentials.js"; export interface DeviceAuthStartResult { device_code: string; user_code: string; verification_uri: string; verification_uri_complete: string; expires_in: number; interval: number; } export interface DeviceAuthTokenResult { access_token: string; refresh_token: string; token_type: string; expires_in: number; user?: { id: string; email: string; }; } /** * Custom error thrown when the MCP server needs authentication * but no credentials are available and device auth hasn't been started. */ export declare class NeedsAuthError extends Error { readonly verificationUri: string; readonly userCode: string; constructor(verificationUri: string, userCode: string); } /** * DeviceAuthFlow implements RFC 8628 Device Authorization Grant * for connecting the MCP server to a user's OpenEphemeris account. */ export declare class DeviceAuthFlow { private baseURL; private credentialManager; constructor(baseURL?: string, credentialManager?: CredentialManager); /** * Start the device authorization flow. * Calls POST /api/device/authorize to get a device code + user code. */ start(clientName?: string): Promise; /** * Poll the token endpoint until the user authorizes the device code * or the code expires. * * @param deviceCode - The device_code from start() * @param onPending - Optional callback fired on each "authorization_pending" poll * @returns The token result with access_token and refresh_token */ poll(deviceCode: string, onPending?: (attempt: number) => void): Promise; /** * Start the full device auth flow: request code, print instructions, poll for token. * This is the main entry point for interactive use. */ authenticate(): Promise; }