import {
  OAuthClientInformationContext,
  OAuthClientMetadata,
  OAuthClientProvider,
  OAuthDiscoveryState,
  StoredOAuthClientInformation,
  StoredOAuthTokens
} from "@modelcontextprotocol/client";

//#region src/mcp/do-oauth-client-provider.d.ts
interface AgentMcpOAuthProvider extends OAuthClientProvider {
  authUrl: string | undefined;
  clientId: string | undefined;
  serverId: string | undefined;
  checkState(state: string): Promise<{
    valid: boolean;
    serverId?: string;
    error?: string;
  }>;
  consumeState(state: string): Promise<void>;
  runWithCodeVerifierState?<T>(
    state: string,
    callback: () => Promise<T>
  ): Promise<T>;
  deleteCodeVerifier(): Promise<void>;
}
/**
 * @deprecated Use {@link AgentMcpOAuthProvider} instead.
 */
type AgentsOAuthProvider = AgentMcpOAuthProvider;
declare class DurableObjectOAuthClientProvider implements AgentMcpOAuthProvider {
  storage: DurableObjectStorage;
  clientName: string;
  baseRedirectUrl: string;
  private _authUrl_;
  private _serverId_;
  private _clientId_;
  constructor(
    storage: DurableObjectStorage,
    clientName: string,
    baseRedirectUrl: string
  );
  get clientMetadata(): OAuthClientMetadata;
  get clientUri(): string;
  get redirectUrl(): string;
  get clientId(): string;
  set clientId(clientId_: string);
  get serverId(): string;
  set serverId(serverId_: string);
  keyPrefix(clientId: string): string;
  clientInfoKey(clientId: string): string;
  discoveryStateKey(): string;
  saveDiscoveryState(state: OAuthDiscoveryState): Promise<void>;
  discoveryState(): Promise<OAuthDiscoveryState | undefined>;
  clientInformation(
    _context?: OAuthClientInformationContext
  ): Promise<StoredOAuthClientInformation | undefined>;
  saveClientInformation(
    clientInformation: StoredOAuthClientInformation,
    _context?: OAuthClientInformationContext
  ): Promise<void>;
  tokenKey(clientId: string): string;
  tokens(
    _context?: OAuthClientInformationContext
  ): Promise<StoredOAuthTokens | undefined>;
  saveTokens(
    tokens: StoredOAuthTokens,
    _context?: OAuthClientInformationContext
  ): Promise<void>;
  get authUrl(): string | undefined;
  stateKey(nonce: string): string;
  state(): Promise<string>;
  checkState(state: string): Promise<{
    valid: boolean;
    serverId?: string;
    error?: string;
  }>;
  consumeState(state: string): Promise<void>;
  redirectToAuthorization(authUrl: URL): Promise<void>;
  invalidateCredentials(
    scope: "all" | "client" | "tokens" | "verifier" | "discovery"
  ): Promise<void>;
  codeVerifierKey(clientId: string): string;
  stateCodeVerifierPrefix(clientId: string): string;
  stateCodeVerifierKey(clientId: string, nonce: string): string;
  challengeCodeVerifierPrefix(clientId: string): string;
  challengeCodeVerifierKey(clientId: string, codeChallenge: string): string;
  codeVerifierKeys(
    clientId: string,
    options?: {
      includeChallengeKeys?: boolean;
    }
  ): Promise<string[]>;
  saveCodeVerifier(verifier: string): Promise<void>;
  private deleteExpiredChallengeCodeVerifiers;
  codeVerifier(): Promise<string>;
  private codeVerifierForState;
  runWithCodeVerifierState<T>(
    state: string,
    callback: () => Promise<T>
  ): Promise<T>;
  deleteCodeVerifier(): Promise<void>;
}
//#endregion
export {
  AgentsOAuthProvider as n,
  DurableObjectOAuthClientProvider as r,
  AgentMcpOAuthProvider as t
};
//# sourceMappingURL=do-oauth-client-provider-VTZj2VtM.d.ts.map
