UNPKG

@ceramicnetwork/core

Version:

Typescript implementation of the Ceramic protocol

19 lines 671 B
import * as random from '@stablelib/random'; import { peerIdFromCID } from '@libp2p/peer-id'; import { serialize } from '../../index.js'; import { CommonTestUtils as TestUtils } from '@ceramicnetwork/common-test-utils'; export function randomPeerId() { return peerIdFromCID(TestUtils.randomCID(0, 0x70)); } export function asIpfsMessage(data, from = randomPeerId()) { return { type: 'signed', from: from, topic: 'topic', data: serialize(data), sequenceNumber: BigInt(random.randomUint32()), signature: random.randomBytes(10), key: random.randomBytes(10), }; } //# sourceMappingURL=as-ipfs-message.js.map