import type { BearerTokenHeader, ClientChallengeResponseHeader, ClientResponse, ServerChallengeHeader, VerifyClientChallengeResponseOptions, VerifyPeer } from './index.ts'; import type { PeerId, PrivateKey, PublicKey, AbortOptions } from '@libp2p/interface'; export declare function isClientChallengeResponse(obj?: any): obj is ClientChallengeResponseHeader; export declare function isServerChallenge(obj?: any): obj is ServerChallengeHeader; export declare function isBearerToken(obj: any): obj is BearerTokenHeader; /** * Verify the response to the client challenge created by * `createClientChallenge` */ export declare function verifyClientChallengeResponse(authHeader: ClientChallengeResponseHeader, hostname: string, clientKey: PrivateKey, opts?: VerifyClientChallengeResponseOptions): Promise; export declare function respondToServerChallenge(serverChallenge: ServerChallengeHeader, hostname: string, clientKey: PrivateKey): Promise; export declare function decodeBearerToken(authHeader: BearerTokenHeader, clientKey: PrivateKey, challenge: string, hostname: string, serverPublicKey: PublicKey): Promise; export declare class ClientInitiatedHandshake { private readonly clientKey; private readonly challenge; private readonly hostname; private readonly verifyPeer?; private state; serverId?: PeerId; bearer?: string; constructor(clientKey: PrivateKey, hostname: string, verifyPeer?: VerifyPeer); /** * Step 1, send the server a challenge */ getChallenge(): string; /** * Step 2, verify the server response, and answer the server challenge */ verifyServer(header: string, opts?: AbortOptions): Promise; /** * Step 3, decode the bearer token sent by the server */ decodeBearerToken(header: string): string; } export declare class ServerInitiatedHandshake { private readonly clientKey; private readonly hostname; private readonly verifyPeer?; private state; serverId?: PeerId; bearer?: string; private serverPublicKey?; private challenge?; constructor(clientKey: PrivateKey, hostname: string, verifyPeer?: VerifyPeer); /** * Step 1 respond to the server challenge and issue our own challenge */ answerServerChallenge(header: string, opts?: AbortOptions): Promise; /** * Step 2, verify the server response and extract the bearer token */ decodeBearerToken(header: string): Promise; } //# sourceMappingURL=client.d.ts.map