/** * OAuth Token Types and Utilities * * Shared type definitions and token utilities for OAuth modules. */ import type { UnknownObject } from '../../modules/pipeline/types/common-types.js'; export type StoredOAuthToken = UnknownObject & { access_token?: string; AccessToken?: string; refresh_token?: string; api_key?: string; apiKey?: string; expires_at?: number | string; expired?: number | string; expiry_date?: number | string; norefresh?: boolean; }; /** * Check if value is a non-empty string */ export declare function hasNonEmptyString(value: unknown): value is string; /** * Extract access token from stored token */ export declare function extractAccessToken(token: StoredOAuthToken | null): string | undefined; /** * Extract API key from stored token */ export declare function extractApiKey(token: StoredOAuthToken | null): string | undefined; /** * Check if token has API key field */ export declare function hasApiKeyField(token: StoredOAuthToken | null): boolean; /** * Check if token has access token */ export declare function hasAccessToken(token: StoredOAuthToken | null): boolean; /** * Check if Qwen has stable API key (not fallback from access_token) */ export declare function hasStableQwenApiKey(token: StoredOAuthToken | null): boolean; /** * Check if token has no-refresh flag */ export declare function hasNoRefreshFlag(token: StoredOAuthToken | null): boolean; /** * Get token expiry timestamp */ export declare function getExpiresAt(token: StoredOAuthToken | null): number | null; /** * Resolve project ID from token */ export declare function resolveProjectId(token: UnknownObject | null): string | undefined; /** * Normalize Gemini CLI account token format */ export declare function normalizeGeminiCliAccountToken(token: UnknownObject): StoredOAuthToken | null; /** * Sanitize token to standard format */ export declare function sanitizeToken(token: UnknownObject | null): StoredOAuthToken | null;