import { type EnvironmentConfig } from "../../src/config/index.js"; import { deleteToken, hasToken, readToken, saveToken } from "./token-store.js"; import { type SpinnerController } from "../ui/progress.js"; /** * Describe where an API-token credential actually came from. * * `.env` files in the working directory are loaded into the environment, so a * token can arrive under `VERYFRONT_API_TOKEN` while that variable is unset in * the developer's shell. Reporting only the variable name sends them to check * something they can see is empty; naming the file ends the search. Identity is * directory-dependent for every command that infers a project from config, so * this is worth the extra clause. */ export declare function formatEnvSourcePathForDisplay(file: string, currentCwd?: string): string; export type AuthMethod = "google" | "github" | "microsoft" | "token"; export interface UserInfo { id: string; email: string; name?: string; } export interface ApiKeyIdentity { authenticated: true; type: "apiKey"; } export type AuthIdentity = UserInfo | ApiKeyIdentity; export interface CredentialValidationOptions { throwOnNetworkError?: boolean; throwOnCredentialValidationUnavailable?: boolean; /** Reuse a caller-owned cancellation or deadline across validation attempts. */ signal?: AbortSignal; /** * Abort the request after this many milliseconds. Callers that must stay * responsive pass a deadline; omitting it keeps the previous unbounded * behaviour for callers that are already the user's main action. */ timeoutMs?: number; } /** Test seam: shrink the preflight deadline so a stall is observable quickly. */ export declare function __setExistingSessionTimeoutForTests(ms?: number): void; export declare function createOAuthState(): string; export declare function createOAuthAuthorizationUrl(provider: "google" | "github" | "microsoft", callbackUrl: string, state: string, env?: EnvironmentConfig): string; export declare function validateToken(token: string, env?: EnvironmentConfig, options?: CredentialValidationOptions): Promise; export declare function isApiKeyToken(token: string): boolean; export declare function isApiKeyIdentity(identity: AuthIdentity): identity is ApiKeyIdentity; export declare function validateCredential(token: string, env?: EnvironmentConfig, options?: CredentialValidationOptions): Promise; export declare function openOAuthLogin(authUrl: string, spinner: SpinnerController, opener?: (url: string) => Promise): Promise; export declare function login(method?: AuthMethod, env?: EnvironmentConfig, projectDir?: string): Promise; export declare function ensureAuthenticated(env?: EnvironmentConfig, projectDir?: string): Promise; export declare function logout(env?: EnvironmentConfig): Promise; export declare function whoami(env?: EnvironmentConfig): Promise; export { deleteToken, hasToken, readToken, saveToken }; //# sourceMappingURL=login.d.ts.map