/** * SDN Node - Main P2P node implementation for browsers */ import { StoredRecord } from "./storage"; import { EdgeDiscovery } from "./edge-discovery"; import { SchemaName } from "./schemas"; import type { DerivedIdentity } from "./crypto/types"; import { type DiscoveredProvider, type ModuleDeliveryEvent, type ModuleGrantRequestOptions, type ModuleGrantResult, type EncryptedModuleBundleResult } from "./module-delivery"; export declare const LEGACY_ID_EXCHANGE_PROTOCOL = "/space-data-network/id-exchange/1.0.0"; export declare const IPFS_BOOTSTRAP_PEERS: readonly ["/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN", "/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb", "/dnsaddr/bootstrap.libp2p.io/p2p/QmZa1sAxajnQjVM8WjWXoMbmPd7NsWhfKsPkErzpm9wGkp", "/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa", "/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt"]; export interface SDNConfig { edgeRelays?: string[]; bootstrapPeers?: string[]; includeIPFSBootstrap?: boolean; /** Enable libp2p Identify service. Disabled by default for lean browser module delivery. */ enableIdentify?: boolean; ipfsApiBaseUrl?: string; ipfsGatewayBaseUrl?: string; ipfsFetchTimeoutMs?: number; idExchangeProtocol?: string; enableStorage?: boolean; storeName?: string; /** Private key for auth challenge signing (32 bytes Ed25519 seed) */ privateKey?: Uint8Array; /** Full HD wallet-derived identity (secp256k1 for PeerID + Ed25519 for auth) */ identity?: DerivedIdentity; /** Enable relay load probing for load balancing (default: true) */ enableRelayProbing?: boolean; /** Interval between relay probes in ms (default: 30000) */ relayProbeIntervalMs?: number; } export interface SDNNodeEvents { onMessage?: (schema: SchemaName, data: unknown, from: string) => void; onPeerConnected?: (peerId: string) => void; onPeerDisconnected?: (peerId: string) => void; onModuleDeliveryEvent?: (event: ModuleDeliveryEvent) => void; } export declare class SDNNode { private libp2p; private storage; private config; private events; private subscriptions; private privateKey; private cryptoReady; private discovery; private constructor(); /** * Create and start a new SDN node */ static create(config?: SDNConfig, events?: SDNNodeEvents): Promise; private init; /** * Get the node's peer ID */ get peerId(): string; /** * Get list of connected peers */ get peers(): string[]; /** * Publish data to a schema topic */ publish(schema: SchemaName, data: object): Promise; /** * Set the private key for auth challenge signing */ setPrivateKey(key: Uint8Array): void; /** * Check if auth challenge signing is available */ get canSign(): boolean; /** * Subscribe to a schema topic */ subscribe(schema: SchemaName, handler?: (data: unknown, from: string) => void): Promise; /** * Unsubscribe from a schema topic */ unsubscribe(schema: SchemaName): Promise; /** * Query local storage for records */ query(schema: SchemaName, filter?: { peerId?: string; since?: Date; }): Promise; /** * Get a specific record by CID */ get(schema: SchemaName, cid: string): Promise; /** * Connect to a specific peer */ dial(addr: string): Promise; /** * Dial through a relay to reach a peer behind a firewall */ dialThroughRelay(relayAddr: string, targetPeerId: string): Promise; /** * Dial a specific protocol through a relay circuit and return the first reply chunk. */ dialProtocol(targetPeerId: string, protocolId: string, payload: Uint8Array, candidateAddrs?: string[]): Promise; dialProtocolThroughRelay(relayAddr: string, targetPeerId: string, protocolId: string, payload: Uint8Array | string): Promise; /** * Compatibility helper for the historical id-exchange relay probe script. */ idExchangeThroughRelay(relayAddr: string, targetPeerId: string, message?: string): Promise; discoverProviders(discoveryCID: string): Promise; fetchCIDBytes(cid: string): Promise; requestModuleGrant(options: Omit & { requesterIdentity?: ModuleGrantRequestOptions["requesterIdentity"]; }): Promise; requestEncryptedModuleBundle(options: Omit & { requesterIdentity?: ModuleGrantRequestOptions["requesterIdentity"]; }): Promise; /** * Stop the node */ stop(): Promise; /** * Get the EdgeDiscovery instance for advanced relay management. */ getDiscovery(): EdgeDiscovery | null; /** * Get supported schemas */ static get schemas(): readonly SchemaName[]; static get ipfsBootstrapPeers(): readonly string[]; static get moduleDeliveryProtocolId(): string; } //# sourceMappingURL=node.d.ts.map