import type { StoredOAuthCredential } from './credentials.js'; export declare const DEFAULT_CLI_CLIENT_ID = "synomem-cli"; export declare const DEFAULT_CALLBACK_PORT = 43817; export declare const DEFAULT_CLI_SCOPE = "openid offline_access synomem:read synomem:write"; export interface ApiAuthorizationMetadata { resource: string; issuer: string; authorizationEndpoint: string; tokenEndpoint: string; } /** HTTPS, or loopback HTTP (development against a local stack). */ export declare function secureUrl(value: string, label: string): URL; /** * Where to sign in for this API, validated. * * The protected-resource metadata must name THIS API as its resource and at * least one authorization server; the authorization server's metadata must * name itself as issuer, publish HTTPS endpoints and support S256. A mismatch * anywhere stops the login before a browser opens. */ export declare function discoverApiAuthorization(apiUrl: string, fetchImplementation?: typeof fetch): Promise; export declare const TOKEN_REQUEST_TIMEOUT_MS = 20000; export interface OAuthLoginOptions { apiUrl: string; clientId?: string; scope?: string; callbackPort?: number; fetch?: typeof fetch; openBrowser?: (url: URL) => void; timeoutMs?: number; } /** Runs the browser flow and returns the credential for the caller to store. */ export declare function loginWithOAuth(options: OAuthLoginOptions): Promise; /** * Spends the refresh token once. Callers hold the credential lock and write the * result before releasing it; a failure here is never retried with the same * (possibly consumed) refresh token. */ export declare function refreshOAuthCredential(credential: StoredOAuthCredential, fetchImplementation?: typeof fetch): Promise; //# sourceMappingURL=oauth.d.ts.map