import type { OAuthDiscoveryState } from "@modelcontextprotocol/sdk/client/auth.js";
import type { OAuthClientInformationFull } from "@modelcontextprotocol/sdk/shared/auth.js";
export type McpClientRegistration = OAuthClientInformationFull & {
    redirectUrisSent?: string[];
};
export interface McpAuthorizationProof {
    readonly credentialIdentity: string;
    readonly previousCredentialIdentity?: string;
    readonly issuer: string;
    readonly resource: string;
    readonly clientIdentity: string;
    readonly scope: string;
    readonly refreshScope?: string;
}
export interface McpAuthorization {
    readonly version: 1;
    readonly id: string;
    readonly proof?: McpAuthorizationProof;
}
export interface McpStoredAuth {
    readonly scope?: string;
    readonly refreshScope?: string;
    readonly authorization?: McpAuthorization;
    accessToken?: string;
    refreshToken?: string;
    clientInfo?: McpClientRegistration;
    pendingClientInfo?: McpClientRegistration;
    codeVerifier?: string;
    discoveryState?: OAuthDiscoveryState;
    resource?: string;
    expiresAt?: number;
    issuer?: string;
}
export interface TokenStoreLockOptions {
    retries?: number;
    stale?: number;
}
export interface TokenStoreOptions {
    serverName: string;
    serverUrl: string;
    agentDir?: string;
    lock?: TokenStoreLockOptions;
    disableLock?: boolean;
}
export declare class LockAcquireError extends Error {
    readonly lockPath: string;
    constructor(lockPath: string, cause: unknown);
}
export declare function hashServerUrl(serverUrl: string): string;
export declare function hashServerKey(serverName: string, serverUrl: string): string;
export declare class McpTokenStore<TRecord extends McpStoredAuth = McpStoredAuth> {
    #private;
    readonly serverName: string;
    readonly serverUrl: string;
    constructor(options: TokenStoreOptions);
    get rootDir(): string;
    get agentDir(): string;
    get dir(): string;
    get tokensPath(): string;
    get lockPath(): string;
    get legacyDir(): string;
    read(): TRecord | undefined;
    readAsync(): Promise<TRecord | undefined>;
    update(mutate: (current: TRecord | undefined) => TRecord | undefined): Promise<TRecord | undefined>;
    write(record: TRecord): Promise<void>;
    withLock<T>(fn: () => Promise<T> | T): Promise<T>;
    readUnlocked(): TRecord | undefined;
    writeUnlocked(record: TRecord | undefined): void;
    clear(): Promise<void>;
}
//# sourceMappingURL=token-store.d.ts.map