/** * Anthropic OAuth 2.0 Device Flow Implementation * * Implements OAuth 2.0 device authorization grant flow for Anthropic Claude API. * Based on the OAuth 2.0 Device Authorization Grant specification (RFC 8628). */ import { type DeviceCodeResponse, type OAuthToken } from './types.js'; /** * Configuration for Anthropic device flow authentication */ interface AnthropicFlowConfig { clientId: string; authorizationEndpoint: string; tokenEndpoint: string; scopes: string[]; } /** * Anthropic-specific OAuth 2.0 device flow implementation. * Handles authentication for Claude API access. */ export declare class AnthropicDeviceFlow { private config; private codeVerifier?; private _codeChallenge?; private state?; private redirectUri; revokeToken?: (token: string) => Promise; constructor(config?: Partial); /** * Generates PKCE code verifier and challenge using S256 method */ private generatePKCE; /** * Initiates the OAuth flow by constructing the authorization URL. * Since Anthropic doesn't have a device flow, we simulate it with authorization code flow. */ initiateDeviceFlow(redirectUri?: string): Promise; /** * Exchange authorization code for access token (PKCE flow) */ exchangeCodeForToken(authCodeWithState: string): Promise; getState(): string; buildAuthorizationUrl(redirectUri: string): string; /** * Polls for the access token after user authorization. */ pollForToken(deviceCode: string): Promise; /** * Refreshes an expired access token using a refresh token. */ refreshToken(refreshToken: string): Promise; /** * Maps Anthropic's token response to our standard OAuthToken format. */ private mapTokenResponse; } export {};