@libp2p/floodsub
Version:
libp2p-floodsub, also known as pubsub-flood or just dumbsub, this implementation of pubsub focused on delivering an API for Publish/Subscribe, but with no CastTree Forming (it just floods the network).
25 lines • 1.04 kB
TypeScript
import type { PubSubRPCMessage } from './floodsub.ts';
import type { Message } from './index.ts';
import type { PublicKey } from '@libp2p/interface';
/**
* Generate a random sequence number
*/
export declare function randomSeqno(): bigint;
/**
* Generate a message id, based on the `key` and `seqno`
*/
export declare const msgId: (key: PublicKey, seqno: bigint) => Uint8Array;
/**
* Generate a message id, based on message `data`
*/
export declare const noSignMsgId: (data: Uint8Array) => Uint8Array | Promise<Uint8Array>;
/**
* Check if any member of the first set is also a member
* of the second set
*/
export declare const anyMatch: (a: Set<number> | number[], b: Set<number> | number[]) => boolean;
export declare const toMessage: (message: PubSubRPCMessage) => Promise<Message>;
export declare const toRpcMessage: (message: Message) => PubSubRPCMessage;
export declare const bigIntToBytes: (num: bigint) => Uint8Array;
export declare const bigIntFromBytes: (num: Uint8Array) => bigint;
//# sourceMappingURL=utils.d.ts.map