libp2p-pubsub
Version:
29 lines • 1.08 kB
TypeScript
import type * as RPC from './message/rpc.js';
import type { Message } from 'libp2p-interfaces/pubsub';
/**
* Generate a random sequence number
*/
export declare const randomSeqno: () => any;
/**
* Generate a message id, based on the `from` and `seqno`
*/
export declare const msgId: (from: Uint8Array | string, seqno: Uint8Array) => Uint8Array;
/**
* Generate a message id, based on message `data`
*/
export declare const noSignMsgId: (data: Uint8Array) => import("multiformats/hashes/hasher").Await<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;
/**
* Make everything an array
*/
export declare const ensureArray: <T>(maybeArray: T | T[]) => T[];
/**
* Ensures `message.from` is base58 encoded
*/
export declare const normalizeInRpcMessage: (message: RPC.RPC.IMessage, peerId?: string | undefined) => any;
export declare const normalizeOutRpcMessage: (message: Message) => Message;
//# sourceMappingURL=utils.d.ts.map