/** * @packageDocumentation * * This is an implementation of the [Peer ID Auth](https://github.com/libp2p/specs/blob/master/http/peer-id-auth.md) * spec that allows clients and servers to exchange PeerIds. */ import type { AbortOptions, PeerId, PrivateKey } from '@libp2p/interface'; export * from './errors.ts'; export declare const PEER_ID_AUTH_SCHEME = "libp2p-PeerID"; export declare const HTTP_PEER_ID_AUTH_PROTOCOL = "/http-peer-id-auth/1.0.0"; export declare const DEFAULT_AUTH_TOKEN_TTL: number; export interface ClientChallengeHeader { 'challenge-server': string; 'public-key': string; } export interface ClientChallengeResponseHeader { 'challenge-client': string; 'public-key': string; sig: string; opaque: string; } export interface BearerTokenHeader { bearer: string; sig?: string; } export interface OpaqueDataHeader { opaque: string; sig: string; } export interface ServerChallengeHeader { 'challenge-client': string; 'public-key': string; opaque: string; } export interface ServerChallengeResponseHeader { 'challenge-server': string; 'public-key': string; opaque: string; sig: string; } export interface ServerResponse { /** * The PeerId of the client */ peerId: PeerId; /** * If present this should be sent to the client as a `authentication-info` * header */ info?: string; /** * If present this should be sent to the client as a `www-authenticate` header */ authenticate?: string; } export interface ClientResponse { /** * The PeerId of the server */ peerId: PeerId; /** * If present this should be sent to the client as a `www-authenticate` header */ authenticate?: string; /** * If present this should be used for subsequent requests */ bearer?: string; } export interface VerifyPeer { (peerId: PeerId, opts?: AbortOptions): boolean | Promise; } export interface VerifyClientChallengeResponseOptions extends AbortOptions { verifyPeer?: VerifyPeer; tokenTTL?: number; } export declare function createServerChallenge(hostname: string, serverKey: PrivateKey): Promise; /** * Handle incoming messages from the authenticating client */ export declare function serverResponds(authHeader: string, hostname: string, serverKey: PrivateKey, tokenTTL?: number): Promise; export { ClientInitiatedHandshake, ServerInitiatedHandshake } from './client.ts'; //# sourceMappingURL=index.d.ts.map