lotus-sdk
Version:
Central repository for several classes of tools for integrating with, and building for, the Lotusia ecosystem
19 lines • 874 B
TypeScript
import { P2PMessage } from './types.js';
export declare class P2PProtocol {
createMessage<T = unknown>(type: string, payload: T, from: string, options?: {
to?: string;
protocol?: string;
signature?: Buffer;
}): P2PMessage<T>;
serialize(message: P2PMessage): Buffer;
deserialize(data: Buffer): P2PMessage;
validateMessage(message: P2PMessage): boolean;
validateMessageSize(message: P2PMessage, maxSize?: number): boolean;
computeMessageHash(message: P2PMessage): string;
createHandshake(peerId: string, metadata?: Record<string, unknown>): P2PMessage;
createHeartbeat(peerId: string): P2PMessage;
createDisconnect(peerId: string, reason?: string): P2PMessage;
createError(peerId: string, error: string, context?: unknown): P2PMessage;
private _generateMessageId;
}
//# sourceMappingURL=protocol.d.ts.map