export declare const DEFAULT_API_URL = "https://oneforall-api.brandon-813.workers.dev";
/** Scope names. Ask only for what your app uses. */
export declare const SCOPES: {
    /** Groq AI (chat, transcription) through One For All Auth. Your app never sees the key. */
    readonly GROQ: "llm:groq";
    /** Spotify: now playing and playback control (user needs Spotify Premium). */
    readonly SPOTIFY: "spotify:playback";
};
export interface TokenStorage {
    get(key: string): Promise<string | null>;
    set(key: string, value: string): Promise<void>;
    remove(key: string): Promise<void>;
}
/** Minimal shape of the Even Hub bridge used for storage. */
export interface EvenStorageBridge {
    getLocalStorage(key: string): Promise<string>;
    setLocalStorage(key: string, value: string): Promise<boolean>;
}
export declare function evenHubStorage(bridge: EvenStorageBridge): TokenStorage;
export interface OneForAllAuthOptions {
    /** Your app ID from the One For All Auth dashboard (Developer apps). */
    clientId: string;
    /** Defaults to the hosted One For All Auth API. */
    apiUrl?: string;
    /** Access the app can't work without. The user can't approve until these are set up. */
    scopes?: string[];
    /** Access the app uses if available. Skipped (not blocking) when the user hasn't set it up. */
    optionalScopes?: string[];
    storage: TokenStorage;
}
export interface DeviceLogin {
    /** Show this to the user (phone screen and glasses), e.g. "BCDF-GHJK". */
    userCode: string;
    /** Where to enter the code by hand, e.g. on another device. */
    verificationUri: string;
    /** Same page with the code already filled in. */
    verificationUriComplete: string;
    expiresIn: number;
    /** Opens the approval page with the code filled in. Returns false if the browser blocked it. */
    open(): boolean;
    /** Resolves when the user approves; rejects with OneForAllAuthError if they deny, cancel, or the code expires. */
    done: Promise<void>;
    cancel(): void;
}
export declare class OneForAllAuthError extends Error {
    readonly code: string;
    constructor(code: string, message?: string);
}
export declare class OneForAllAuth {
    private readonly opts;
    private accessToken;
    private accessExpiresAt;
    private refreshing;
    private readonly providerTokens;
    private readonly storageKey;
    private readonly scopeKey;
    private readonly apiUrl;
    constructor(opts: OneForAllAuthOptions);
    isConnected(): Promise<boolean>;
    /** Whether the user granted this access (e.g. "llm:groq"). Optional services may be missing. */
    hasScope(scope: string): Promise<boolean>;
    /** Base URL for OpenAI-compatible clients, e.g. proxyBaseUrl("groq") + "/chat/completions". */
    proxyBaseUrl(provider: string): string;
    /**
     * Starts the "enter this code" login. Calling it while already connected reconnects:
     * once the user approves, the old connection is revoked, e.g. to add a service the
     * user has set up since.
     */
    startConnect(): Promise<DeviceLogin>;
    /** fetch() against the One For All Auth API with a valid access token. Retries once after a refresh. */
    fetch(path: string, init?: RequestInit): Promise<Response>;
    /**
     * Short-lived token for a provider that apps call directly (e.g. "spotify" →
     * use it as `Authorization: Bearer` against api.spotify.com). Cached until shortly before expiry.
     */
    getProviderToken(provider: string): Promise<string>;
    /**
     * OpenAI-style chat completion through One For All Auth (e.g. provider "groq").
     * Returns the parsed JSON response. Throws OneForAllAuthError (see `code`) on failure.
     */
    chat<T = ChatCompletion>(provider: string, body: Record<string, unknown>): Promise<T>;
    /**
     * Calls the Spotify Web API (https://api.spotify.com/v1 + path) with a short-lived token.
     * Returns the raw Response (Spotify uses 204 for "nothing playing").
     * Your app.json network whitelist must include https://api.spotify.com.
     */
    spotify(path: string, init?: RequestInit): Promise<Response>;
    /** Disconnects this app from the user's account and forgets the tokens. */
    disconnect(): Promise<void>;
    private getAccessToken;
    private refresh;
    private saveTokens;
    private post;
}
export declare const BRAND_COLOR = "#71e7eb";
export declare const BRAND_INK = "#131b24";
/** The One For All Auth dot mark, drawn in `color`. `size` is its height; it is wider than tall. */
export declare function brandMarkSvg(color?: string, size?: number): string;
/**
 * Creates the official Connect button with its styles built in (no CSS needed).
 * `label` defaults to "Connect with One For All Auth"; use "Reconnect" text only for reconnecting.
 */
export declare function createConnectButton(options?: {
    label?: string;
    onClick?: () => void;
}): HTMLButtonElement;
/** The parts of an OpenAI-style chat completion most apps need. */
export interface ChatCompletion {
    choices: {
        message: {
            role: string;
            content: string;
        };
    }[];
    [key: string]: unknown;
}
