/** * @packageDocumentation * * A [libp2p transport](https://libp2p.io/docs/transports-overview/) based on [WebTransport](https://www.w3.org/TR/webtransport/). * * > ⚠️ **Note** * > * > This WebTransport implementation currently only allows dialing to other nodes. It does not yet allow listening for incoming dials. This feature requires QUIC support to land in Node JS first. * > * > QUIC support in Node JS is actively being worked on. You can keep an eye on the progress by watching the [related issues on the Node JS issue tracker](https://github.com/nodejs/node/labels/quic) * * @example * * ```TypeScript * import { createLibp2p } from 'libp2p' * import { webTransport } from '@libp2p/webtransport' * import { noise } from '@libp2p/noise' * * const node = await createLibp2p({ * transports: [ * webTransport() * ], * connectionEncrypters: [ * noise() * ] * }) * ``` */ import type { Upgrader, Transport, ComponentLogger, CounterGroup, Metrics, PeerId, OutboundConnectionUpgradeEvents, PrivateKey } from '@libp2p/interface'; import type { MultihashDigest } from 'multiformats/hashes/interface'; import type { ProgressEvent } from 'progress-events'; /** * PEM format server certificate and private key */ export interface WebTransportCertificate { privateKey: string; pem: string; hash: MultihashDigest; secret: string; } export interface WebTransportInit { certificates?: WebTransportCertificate[]; } export interface WebTransportComponents { peerId: PeerId; privateKey: PrivateKey; metrics?: Metrics; logger: ComponentLogger; upgrader: Upgrader; } export interface WebTransportMetrics { dialerEvents: CounterGroup; } export type WebTransportDialEvents = OutboundConnectionUpgradeEvents | ProgressEvent<'webtransport:wait-for-session'> | ProgressEvent<'webtransport:open-authentication-stream'> | ProgressEvent<'webtransport:secure-outbound-connection'> | ProgressEvent<'webtransport:close-authentication-stream'>; export declare function webTransport(init?: WebTransportInit): (components: WebTransportComponents) => Transport; //# sourceMappingURL=index.d.ts.map