|
1 |
| -import { logger } from '@libp2p/logger' |
2 |
| -import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events' |
| 1 | +import { type PubSub, type Message, type StrictNoSign, type StrictSign, type PubSubInit, type PubSubEvents, type PeerStreams, type PubSubRPCMessage, type PubSubRPC, type PubSubRPCSubscription, type SubscriptionChangeData, type PublishResult, type TopicValidatorFn, TopicValidatorResult } from '@libp2p/interface-pubsub' |
3 | 2 | import { CodeError } from '@libp2p/interfaces/errors'
|
| 3 | +import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events' |
| 4 | +import { logger } from '@libp2p/logger' |
| 5 | +import { PeerMap, PeerSet } from '@libp2p/peer-collections' |
| 6 | +import { createTopology } from '@libp2p/topology' |
4 | 7 | import { pipe } from 'it-pipe'
|
5 | 8 | import Queue from 'p-queue'
|
6 |
| -import { createTopology } from '@libp2p/topology' |
7 | 9 | import { codes } from './errors.js'
|
8 | 10 | import { PeerStreams as PeerStreamsImpl } from './peer-streams.js'
|
9 |
| -import { toMessage, ensureArray, noSignMsgId, msgId, toRpcMessage, randomSeqno } from './utils.js' |
10 | 11 | import {
|
11 | 12 | signMessage,
|
12 | 13 | verifySignature
|
13 | 14 | } from './sign.js'
|
| 15 | +import { toMessage, ensureArray, noSignMsgId, msgId, toRpcMessage, randomSeqno } from './utils.js' |
| 16 | +import type { Connection } from '@libp2p/interface-connection' |
14 | 17 | import type { PeerId } from '@libp2p/interface-peer-id'
|
15 | 18 | import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar'
|
16 |
| -import type { Connection } from '@libp2p/interface-connection' |
17 |
| -import { PubSub, Message, StrictNoSign, StrictSign, PubSubInit, PubSubEvents, PeerStreams, PubSubRPCMessage, PubSubRPC, PubSubRPCSubscription, SubscriptionChangeData, PublishResult, TopicValidatorFn, TopicValidatorResult } from '@libp2p/interface-pubsub' |
18 |
| -import { PeerMap, PeerSet } from '@libp2p/peer-collections' |
19 | 19 | import type { Uint8ArrayList } from 'uint8arraylist'
|
20 | 20 |
|
21 | 21 | const log = logger('libp2p:pubsub')
|
@@ -132,7 +132,7 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
132 | 132 | onConnect: this._onPeerConnected,
|
133 | 133 | onDisconnect: this._onPeerDisconnected
|
134 | 134 | })
|
135 |
| - this._registrarTopologyIds = await Promise.all(this.multicodecs.map(async multicodec => await registrar.register(multicodec, topology))) |
| 135 | + this._registrarTopologyIds = await Promise.all(this.multicodecs.map(async multicodec => registrar.register(multicodec, topology))) |
136 | 136 |
|
137 | 137 | log('started')
|
138 | 138 | this.started = true
|
@@ -589,9 +589,9 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
589 | 589 | const signaturePolicy = this.globalSignaturePolicy
|
590 | 590 | switch (signaturePolicy) {
|
591 | 591 | case 'StrictSign':
|
592 |
| - return await signMessage(this.components.peerId, message, this.encodeMessage.bind(this)) |
| 592 | + return signMessage(this.components.peerId, message, this.encodeMessage.bind(this)) |
593 | 593 | case 'StrictNoSign':
|
594 |
| - return await Promise.resolve({ |
| 594 | + return Promise.resolve({ |
595 | 595 | type: 'unsigned',
|
596 | 596 | ...message
|
597 | 597 | })
|
|
0 commit comments