import { Identity } from './identity.js'; import type { SessionRecoveryToken } from './identity.js'; import type { Key } from 'hpke'; /** Network transport used after request encryption and before response decryption. */ export interface TransportOptions { /** * Fetch-compatible implementation for all network I/O, including key * discovery in Transport.create(). Called with no `this`. Defaults to global * fetch. See the README's "Custom network transport" section for what it * receives, what it must do, and which responses are not authenticated. */ fetch?: typeof fetch; } export declare class Transport { private readonly fetchImpl; private serverIdentity; private serverHost; private serverHostname; /** Explicit port from a host-only configuration; undefined means the scheme default. */ private serverPort?; private serverOrigin?; private _lastSessionRecoveryToken?; private requestGeneration; /** `serverHost` is a host (`example.com:8443`) or an origin (`https://example.com`); an origin also pins the scheme. */ constructor(serverIdentity: Identity, serverHost: string, options?: TransportOptions); getSessionRecoveryToken(): SessionRecoveryToken; /** * Create a new transport by fetching server public key. * The optional init is applied to the key fetch (e.g. credentials). */ static create(serverURL: string, init?: RequestInit, options?: TransportOptions): Promise; private static isProblemJSONContentType; private static checkKeyConfigMismatch; private static shouldDecryptResponse; /** * Get the server identity */ getServerIdentity(): Identity; /** * Get the server public key */ getServerPublicKey(): Key; /** * Get the server public key as hex string */ getServerPublicKeyHex(): Promise; /** * Make an encrypted HTTP request. */ private matchesConfiguredServer; request(input: RequestInfo | URL, init?: RequestInit): Promise; /** * Convenience method for GET requests */ get(url: string | URL, init?: RequestInit): Promise; /** * Convenience method for POST requests */ post(url: string | URL, body?: BodyInit, init?: RequestInit): Promise; /** * Convenience method for PUT requests */ put(url: string | URL, body?: BodyInit, init?: RequestInit): Promise; /** * Convenience method for DELETE requests */ delete(url: string | URL, init?: RequestInit): Promise; } /** * Create a new transport instance. * The optional init is applied to the server key fetch (e.g. credentials). */ export declare function createTransport(serverURL: string, init?: RequestInit, options?: TransportOptions): Promise; //# sourceMappingURL=client.d.ts.map