/** * HTTP Client for Hawcx Auth Protocol v2 * * Single endpoint: POST /auth * All actions go through sendAction(). */ import { type Result } from "neverthrow"; import { type AuthError } from "./errors"; import { type Action, type WireResponse } from "./protocol"; import { type Logger } from "./types"; export interface HttpClientConfig { apiBase: string; configId: string; logger?: Logger; /** Request timeout in milliseconds (default: 10000) */ timeout?: number; /** Custom fetch implementation for testing */ fetch?: typeof fetch; } /** * HTTP client for Protocol v2. * Handles retries, timeouts, and error mapping. */ export declare class HttpClient { private readonly config; private readonly api; private readonly logger; constructor(config: HttpClientConfig); /** * Send a Protocol v2 action to the /auth endpoint. */ sendAction(action: Action, session?: string, signal?: AbortSignal): Promise>; /** * Transform SDK-friendly action field names to wire protocol names. * Keeps the developer API clean while matching backend expectations. */ private transformAction; /** * Transform wire protocol response to SDK-friendly format. * Maps method.id -> method.name for cleaner developer API. */ private transformResponse; private mapNetworkError; private mapHttpError; private extractErrorDetails; }