/**
* Hand-authored declarations for the "./net" export of ardegazu-social-kit —
* the compiled dist/net.js. A standalone libp2p node for apps that don't
* already run one (the hub). Requires the optional libp2p peerDependency
* family at runtime; the main entry needs none of it.
*/
import type { Libp2p } from "libp2p";
import type { PubsubLike } from "./index.js";
export interface RelayInfo {
peerId: string;
multiaddrs: string[];
}
/** Fetch the /.well-known/ap2p descriptor; falls back to compiled-in relay info. */
export declare function fetchRelayInfo(descriptorUrl: string, fallback: RelayInfo, timeoutMs?: number): Promise<RelayInfo>;
/** Ephemeral TURN credentials (coturn REST scheme) → RTCConfiguration, cached. */
export declare class IceConfig {
constructor(endpoint: string, forceRelay?: boolean);
get(): Promise<RTCConfiguration>;
}
export declare class NetNode {
readonly node: Libp2p;
readonly relayId: string;
static create(relay: RelayInfo, ice: IceConfig): Promise<NetNode>;
relayConnected(): boolean;
/** Dial (or re-dial after a suspend) the relay; the circuit listener re-takes its reservation. */
redialRelay(): Promise<void>;
private constructor();
}
export interface SocialNetConfig {
descriptorUrl: string;
turnUrl: string;
relayFallback: RelayInfo;
}
export interface SocialNet {
node: NetNode["node"];
pubsub: PubsubLike;
relayId: string;
relayConnected(): boolean;
close(): Promise<void>;
}
export declare function createSocialNode(cfg: SocialNetConfig): Promise<SocialNet>;