import type { OAuth2Config } from "../core/types.js"; /** Default Google OAuth2 token endpoint. */ export declare const GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token"; /** Microsoft OAuth2 token endpoint (common tenant). */ export declare const MICROSOFT_TOKEN_URL = "https://login.microsoftonline.com/common/oauth2/v2.0/token"; /** OAuth2 token endpoint response shape. */ export interface TokenResponse { /** Bearer access token for API or SMTP XOAUTH2. */ access_token: string; /** Token lifetime in seconds. */ expires_in: number; /** Token type (typically `"Bearer"`). */ token_type: string; } /** * OAuth2 client with in-memory token cache and automatic refresh. */ export declare class OAuth2Client { /** OAuth2 configuration supplied at construction. */ private readonly config; /** Cached access token, or null before the first fetch. */ private cachedToken; /** Expiry timestamp (ms) for the cached access token. */ private expiresAt; /** In-flight refresh promise used to deduplicate concurrent refreshes. */ private refreshPromise; /** Creates an OAuth2 client from configuration. */ constructor(config: OAuth2Config); /** * Get a valid access token (cached when still valid, refreshed otherwise). */ getAccessToken(): Promise; /** * Force-refresh the access token regardless of expiry. */ refreshAccessToken(): Promise; /** * Build the XOAUTH2 SASL string for SMTP AUTH (base64-encoded). */ buildXOAUTH2(): Promise; }