Skip to content

Commit 010427b

Browse files
authored
fix: make pubsub message types consistent (#4145)
From field should be a peer id as per the types.
1 parent 3c52cb0 commit 010427b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/pubsub/subscribe.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { logger } from '@libp2p/logger'
22
import { configure } from '../lib/configure.js'
33
import { toUrlSearchParams } from '../lib/to-url-search-params.js'
44
import { textToUrlSafeRpc, rpcToText, rpcToBytes, rpcToBigInt } from '../lib/http-rpc-wire-format.js'
5+
import { peerIdFromString } from '@libp2p/peer-id'
56
const log = logger('ipfs-http-client:pubsub:subscribe')
67

78
/**
@@ -107,7 +108,7 @@ async function readMessages (response, { onMessage, onEnd, onError }) {
107108
}
108109

109110
onMessage({
110-
from: msg.from,
111+
from: peerIdFromString(msg.from),
111112
data: rpcToBytes(msg.data),
112113
sequenceNumber: rpcToBigInt(msg.seqno),
113114
topic: rpcToText(msg.topicIDs[0])

0 commit comments

Comments
 (0)