@libp2p/pubsub
Version:
libp2p pubsub base class
21 lines • 895 B
TypeScript
import type { PeerId, PrivateKey, PubSubRPCMessage, PublicKey, SignedMessage } from '@libp2p/interface';
export declare const SignPrefix: Uint8Array<ArrayBufferLike>;
/**
* Signs the provided message with the given `peerId`
*/
export declare function signMessage(privateKey: PrivateKey, message: {
from: PeerId;
topic: string;
data: Uint8Array;
sequenceNumber: bigint;
}, encode: (rpc: PubSubRPCMessage) => Uint8Array): Promise<SignedMessage>;
/**
* Verifies the signature of the given message
*/
export declare function verifySignature(message: SignedMessage, encode: (rpc: PubSubRPCMessage) => Uint8Array): Promise<boolean>;
/**
* Returns the PublicKey associated with the given message.
* If no valid PublicKey can be retrieved an error will be returned.
*/
export declare function messagePublicKey(message: SignedMessage): PublicKey;
//# sourceMappingURL=sign.d.ts.map