libp2p 0.44.0-cd67b7d8 → 0.44.0-ed2fa794

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,45 @@
1
+ import { logger } from '@libp2p/logger'
2
+ import { CodeError } from '@libp2p/interfaces/errors'
3
+ import * as lp from 'it-length-prefixed'
4
+ import { pipe } from 'it-pipe'
5
+ import first from 'it-first'
6
+ import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
7
+ import { Multiaddr, multiaddr, protocols } from '@multiformats/multiaddr'
1
8
  import { Identify } from './pb/message.js'
9
+ import { RecordEnvelope, PeerRecord } from '@libp2p/peer-record'
2
10
  import {
11
+ AGENT_VERSION,
3
12
  MULTICODEC_IDENTIFY,
4
- MULTICODEC_IDENTIFY_PUSH
13
+ MULTICODEC_IDENTIFY_PUSH,
14
+ IDENTIFY_PROTOCOL_VERSION,
15
+ MULTICODEC_IDENTIFY_PROTOCOL_NAME,
16
+ MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME,
17
+ MULTICODEC_IDENTIFY_PROTOCOL_VERSION,
18
+ MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION
5
19
  } from './consts.js'
6
- import type { Registrar } from '@libp2p/interface-registrar'
20
+ import { codes } from '../errors.js'
21
+ import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar'
22
+ import type { Connection, Stream } from '@libp2p/interface-connection'
23
+ import type { Startable } from '@libp2p/interfaces/startable'
24
+ import { peerIdFromKeys } from '@libp2p/peer-id'
25
+ import type { AbortOptions } from '@libp2p/interfaces'
26
+ import { abortableDuplex } from 'abortable-iterator'
27
+ import { setMaxListeners } from 'events'
7
28
  import type { ConnectionManager } from '@libp2p/interface-connection-manager'
8
29
  import type { PeerId } from '@libp2p/interface-peer-id'
9
- import type { PeerStore } from '@libp2p/interface-peer-store'
30
+ import type { Peer, PeerStore } from '@libp2p/interface-peer-store'
10
31
  import type { AddressManager } from '@libp2p/interface-address-manager'
32
+ import { anySignal } from 'any-signal'
11
33
  import type { EventEmitter } from '@libp2p/interfaces/events'
12
34
  import type { Libp2pEvents } from '@libp2p/interface-libp2p'
13
- import { DefaultIdentifyService } from './identify.js'
35
+ import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
36
+ import { pbStream } from 'it-pb-stream'
37
+ import { isNode, isBrowser, isWebWorker, isElectronMain, isElectronRenderer, isReactNative } from 'wherearewe'
38
+
39
+ const log = logger('libp2p:identify')
40
+
41
+ // https://github.com/libp2p/go-libp2p/blob/8d2e54e1637041d5cf4fac1e531287560bd1f4ac/p2p/protocol/identify/id.go#L52
42
+ const MAX_IDENTIFY_MESSAGE_SIZE = 1024 * 8
14
43
 
15
44
  export interface IdentifyServiceInit {
16
45
  /**
@@ -50,6 +79,477 @@ export interface IdentifyServiceComponents {
50
79
  events: EventEmitter<Libp2pEvents>
51
80
  }
52
81
 
82
+ export interface IdentifyService {
83
+ /**
84
+ * Requests the `Identify` message from peer associated with the given `connection`.
85
+ * If the identified peer does not match the `PeerId` associated with the connection,
86
+ * an error will be thrown.
87
+ */
88
+ identify: (connection: Connection, options?: AbortOptions) => Promise<void>
89
+
90
+ /**
91
+ * Calls `push` on all peer connections
92
+ */
93
+ push: () => Promise<void>
94
+ }
95
+
96
+ const defaultValues = {
97
+ protocolPrefix: 'ipfs',
98
+ agentVersion: AGENT_VERSION,
99
+ // https://github.com/libp2p/go-libp2p/blob/8d2e54e1637041d5cf4fac1e531287560bd1f4ac/p2p/protocol/identify/id.go#L48
100
+ timeout: 60000,
101
+ maxInboundStreams: 1,
102
+ maxOutboundStreams: 1,
103
+ maxPushIncomingStreams: 1,
104
+ maxPushOutgoingStreams: 1,
105
+ maxObservedAddresses: 10,
106
+ maxIdentifyMessageSize: 8192
107
+ }
108
+
109
+ class DefaultIdentifyService implements Startable, IdentifyService {
110
+ private readonly identifyProtocolStr: string
111
+ private readonly identifyPushProtocolStr: string
112
+ public readonly host: {
113
+ protocolVersion: string
114
+ agentVersion: string
115
+ }
116
+
117
+ private started: boolean
118
+ private readonly timeout: number
119
+ private readonly peerId: PeerId
120
+ private readonly peerStore: PeerStore
121
+ private readonly registrar: Registrar
122
+ private readonly connectionManager: ConnectionManager
123
+ private readonly addressManager: AddressManager
124
+ private readonly maxInboundStreams: number
125
+ private readonly maxOutboundStreams: number
126
+ private readonly maxPushIncomingStreams: number
127
+ private readonly maxPushOutgoingStreams: number
128
+ private readonly maxIdentifyMessageSize: number
129
+ private readonly maxObservedAddresses: number
130
+
131
+ constructor (components: IdentifyServiceComponents, init: IdentifyServiceInit) {
132
+ this.started = false
133
+ this.peerId = components.peerId
134
+ this.peerStore = components.peerStore
135
+ this.registrar = components.registrar
136
+ this.addressManager = components.addressManager
137
+ this.connectionManager = components.connectionManager
138
+
139
+ this.identifyProtocolStr = `/${init.protocolPrefix ?? defaultValues.protocolPrefix}/${MULTICODEC_IDENTIFY_PROTOCOL_NAME}/${MULTICODEC_IDENTIFY_PROTOCOL_VERSION}`
140
+ this.identifyPushProtocolStr = `/${init.protocolPrefix ?? defaultValues.protocolPrefix}/${MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME}/${MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION}`
141
+ this.timeout = init.timeout ?? defaultValues.timeout
142
+ this.maxInboundStreams = init.maxInboundStreams ?? defaultValues.maxInboundStreams
143
+ this.maxOutboundStreams = init.maxOutboundStreams ?? defaultValues.maxOutboundStreams
144
+ this.maxPushIncomingStreams = init.maxPushIncomingStreams ?? defaultValues.maxPushIncomingStreams
145
+ this.maxPushOutgoingStreams = init.maxPushOutgoingStreams ?? defaultValues.maxPushOutgoingStreams
146
+ this.maxIdentifyMessageSize = init.maxIdentifyMessageSize ?? defaultValues.maxIdentifyMessageSize
147
+ this.maxObservedAddresses = init.maxObservedAddresses ?? defaultValues.maxObservedAddresses
148
+
149
+ // Store self host metadata
150
+ this.host = {
151
+ protocolVersion: `${init.protocolPrefix ?? defaultValues.protocolPrefix}/${IDENTIFY_PROTOCOL_VERSION}`,
152
+ agentVersion: init.agentVersion ?? defaultValues.agentVersion
153
+ }
154
+
155
+ // When a new connection happens, trigger identify
156
+ components.events.addEventListener('connection:open', (evt) => {
157
+ const connection = evt.detail
158
+ this.identify(connection).catch(err => { log.error('error during identify trigged by connection:open', err) })
159
+ })
160
+
161
+ // When self peer record changes, trigger identify-push
162
+ components.events.addEventListener('self:peer:update', (evt) => {
163
+ void this.push().catch(err => { log.error(err) })
164
+ })
165
+
166
+ // Append user agent version to default AGENT_VERSION depending on the environment
167
+ if (this.host.agentVersion === AGENT_VERSION) {
168
+ if (isNode || isElectronMain) {
169
+ this.host.agentVersion += ` UserAgent=${globalThis.process.version}`
170
+ } else if (isBrowser || isWebWorker || isElectronRenderer || isReactNative) {
171
+ this.host.agentVersion += ` UserAgent=${globalThis.navigator.userAgent}`
172
+ }
173
+ }
174
+ }
175
+
176
+ isStarted (): boolean {
177
+ return this.started
178
+ }
179
+
180
+ async start (): Promise<void> {
181
+ if (this.started) {
182
+ return
183
+ }
184
+
185
+ await this.peerStore.merge(this.peerId, {
186
+ metadata: {
187
+ AgentVersion: uint8ArrayFromString(this.host.agentVersion),
188
+ ProtocolVersion: uint8ArrayFromString(this.host.protocolVersion)
189
+ }
190
+ })
191
+
192
+ await this.registrar.handle(this.identifyProtocolStr, (data) => {
193
+ void this._handleIdentify(data).catch(err => {
194
+ log.error(err)
195
+ })
196
+ }, {
197
+ maxInboundStreams: this.maxInboundStreams,
198
+ maxOutboundStreams: this.maxOutboundStreams
199
+ })
200
+ await this.registrar.handle(this.identifyPushProtocolStr, (data) => {
201
+ void this._handlePush(data).catch(err => {
202
+ log.error(err)
203
+ })
204
+ }, {
205
+ maxInboundStreams: this.maxPushIncomingStreams,
206
+ maxOutboundStreams: this.maxPushOutgoingStreams
207
+ })
208
+
209
+ this.started = true
210
+ }
211
+
212
+ async stop (): Promise<void> {
213
+ await this.registrar.unhandle(this.identifyProtocolStr)
214
+ await this.registrar.unhandle(this.identifyPushProtocolStr)
215
+
216
+ this.started = false
217
+ }
218
+
219
+ /**
220
+ * Send an Identify Push update to the list of connections
221
+ */
222
+ async pushToConnections (connections: Connection[]): Promise<void> {
223
+ const listenAddresses = this.addressManager.getAddresses().map(ma => ma.decapsulateCode(protocols('p2p').code))
224
+ const peerRecord = new PeerRecord({
225
+ peerId: this.peerId,
226
+ multiaddrs: listenAddresses
227
+ })
228
+ const signedPeerRecord = await RecordEnvelope.seal(peerRecord, this.peerId)
229
+ const supportedProtocols = this.registrar.getProtocols()
230
+ const peer = await this.peerStore.get(this.peerId)
231
+ const agentVersion = uint8ArrayToString(peer.metadata.get('AgentVersion') ?? uint8ArrayFromString(this.host.agentVersion))
232
+ const protocolVersion = uint8ArrayToString(peer.metadata.get('ProtocolVersion') ?? uint8ArrayFromString(this.host.protocolVersion))
233
+
234
+ const pushes = connections.map(async connection => {
235
+ let stream: Stream | undefined
236
+
237
+ const signal = AbortSignal.timeout(this.timeout)
238
+
239
+ try {
240
+ // fails on node < 15.4
241
+ setMaxListeners?.(Infinity, signal)
242
+ } catch {}
243
+
244
+ try {
245
+ stream = await connection.newStream([this.identifyPushProtocolStr], {
246
+ signal
247
+ })
248
+
249
+ // make stream abortable
250
+ const source = abortableDuplex(stream, signal)
251
+
252
+ await source.sink(pipe(
253
+ [Identify.encode({
254
+ listenAddrs: listenAddresses.map(ma => ma.bytes),
255
+ signedPeerRecord: signedPeerRecord.marshal(),
256
+ protocols: supportedProtocols,
257
+ agentVersion,
258
+ protocolVersion
259
+ })],
260
+ (source) => lp.encode(source)
261
+ ))
262
+ } catch (err: any) {
263
+ // Just log errors
264
+ log.error('could not push identify update to peer', err)
265
+ } finally {
266
+ if (stream != null) {
267
+ stream.close()
268
+ }
269
+ }
270
+ })
271
+
272
+ await Promise.all(pushes)
273
+ }
274
+
275
+ /**
276
+ * Calls `push` on all peer connections
277
+ */
278
+ async push (): Promise<void> {
279
+ // Do not try to push if we are not running
280
+ if (!this.isStarted()) {
281
+ return
282
+ }
283
+
284
+ const connections: Connection[] = []
285
+
286
+ await Promise.all(
287
+ this.connectionManager.getConnections().map(async conn => {
288
+ try {
289
+ const peer = await this.peerStore.get(conn.remotePeer)
290
+
291
+ if (!peer.protocols.includes(this.identifyPushProtocolStr)) {
292
+ return
293
+ }
294
+
295
+ connections.push(conn)
296
+ } catch (err: any) {
297
+ if (err.code !== codes.ERR_NOT_FOUND) {
298
+ throw err
299
+ }
300
+ }
301
+ })
302
+ )
303
+
304
+ await this.pushToConnections(connections)
305
+ }
306
+
307
+ async _identify (connection: Connection, options: AbortOptions = {}): Promise<Identify> {
308
+ let stream: Stream | undefined
309
+
310
+ const signal = anySignal([AbortSignal.timeout(this.timeout), options?.signal])
311
+
312
+ try {
313
+ // fails on node < 15.4
314
+ setMaxListeners?.(Infinity, signal)
315
+ } catch {}
316
+
317
+ try {
318
+ stream = await connection.newStream([this.identifyProtocolStr], {
319
+ signal
320
+ })
321
+
322
+ // make stream abortable
323
+ const source = abortableDuplex(stream, signal)
324
+
325
+ const data = await pipe(
326
+ [],
327
+ source,
328
+ (source) => lp.decode(source, {
329
+ maxDataLength: this.maxIdentifyMessageSize ?? MAX_IDENTIFY_MESSAGE_SIZE
330
+ }),
331
+ async (source) => await first(source)
332
+ )
333
+
334
+ if (data == null) {
335
+ throw new CodeError('No data could be retrieved', codes.ERR_CONNECTION_ENDED)
336
+ }
337
+
338
+ try {
339
+ return Identify.decode(data)
340
+ } catch (err: any) {
341
+ throw new CodeError(String(err), codes.ERR_INVALID_MESSAGE)
342
+ }
343
+ } finally {
344
+ if (stream != null) {
345
+ stream.close()
346
+ }
347
+ signal.clear()
348
+ }
349
+ }
350
+
351
+ async identify (connection: Connection, options: AbortOptions = {}): Promise<void> {
352
+ const message = await this._identify(connection, options)
353
+ const {
354
+ publicKey,
355
+ protocols,
356
+ observedAddr
357
+ } = message
358
+
359
+ if (publicKey == null) {
360
+ throw new CodeError('public key was missing from identify message', codes.ERR_MISSING_PUBLIC_KEY)
361
+ }
362
+
363
+ const id = await peerIdFromKeys(publicKey)
364
+
365
+ if (!connection.remotePeer.equals(id)) {
366
+ throw new CodeError('identified peer does not match the expected peer', codes.ERR_INVALID_PEER)
367
+ }
368
+
369
+ if (this.peerId.equals(id)) {
370
+ throw new CodeError('identified peer is our own peer id?', codes.ERR_INVALID_PEER)
371
+ }
372
+
373
+ // Get the observedAddr if there is one
374
+ const cleanObservedAddr = getCleanMultiaddr(observedAddr)
375
+
376
+ log('identify completed for peer %p and protocols %o', id, protocols)
377
+ log('our observed address is %s', cleanObservedAddr)
378
+
379
+ if (cleanObservedAddr != null &&
380
+ this.addressManager.getObservedAddrs().length < (this.maxObservedAddresses ?? Infinity)) {
381
+ log('storing our observed address %s', cleanObservedAddr?.toString())
382
+ this.addressManager.addObservedAddr(cleanObservedAddr)
383
+ }
384
+
385
+ await this.#consumeIdentifyMessage(connection.remotePeer, message)
386
+ }
387
+
388
+ /**
389
+ * Sends the `Identify` response with the Signed Peer Record
390
+ * to the requesting peer over the given `connection`
391
+ */
392
+ async _handleIdentify (data: IncomingStreamData): Promise<void> {
393
+ const { connection, stream } = data
394
+
395
+ const signal = AbortSignal.timeout(this.timeout)
396
+
397
+ try {
398
+ // fails on node < 15.4
399
+ setMaxListeners?.(Infinity, signal)
400
+ } catch {}
401
+
402
+ try {
403
+ const publicKey = this.peerId.publicKey ?? new Uint8Array(0)
404
+ const peerData = await this.peerStore.get(this.peerId)
405
+ const multiaddrs = this.addressManager.getAddresses().map(ma => ma.decapsulateCode(protocols('p2p').code))
406
+ let signedPeerRecord = peerData.peerRecordEnvelope
407
+
408
+ if (multiaddrs.length > 0 && signedPeerRecord == null) {
409
+ const peerRecord = new PeerRecord({
410
+ peerId: this.peerId,
411
+ multiaddrs
412
+ })
413
+
414
+ const envelope = await RecordEnvelope.seal(peerRecord, this.peerId)
415
+ signedPeerRecord = envelope.marshal().subarray()
416
+ }
417
+
418
+ const message = Identify.encode({
419
+ protocolVersion: this.host.protocolVersion,
420
+ agentVersion: this.host.agentVersion,
421
+ publicKey,
422
+ listenAddrs: multiaddrs.map(addr => addr.bytes),
423
+ signedPeerRecord,
424
+ observedAddr: connection.remoteAddr.bytes,
425
+ protocols: peerData.protocols
426
+ })
427
+
428
+ // make stream abortable
429
+ const source = abortableDuplex(stream, signal)
430
+
431
+ const msgWithLenPrefix = pipe([message], (source) => lp.encode(source))
432
+ await source.sink(msgWithLenPrefix)
433
+ } catch (err: any) {
434
+ log.error('could not respond to identify request', err)
435
+ } finally {
436
+ stream.close()
437
+ }
438
+ }
439
+
440
+ /**
441
+ * Reads the Identify Push message from the given `connection`
442
+ */
443
+ async _handlePush (data: IncomingStreamData): Promise<void> {
444
+ const { connection, stream } = data
445
+
446
+ try {
447
+ if (this.peerId.equals(connection.remotePeer)) {
448
+ throw new Error('received push from ourselves?')
449
+ }
450
+
451
+ // make stream abortable
452
+ const source = abortableDuplex(stream, AbortSignal.timeout(this.timeout))
453
+ const pb = pbStream(source, {
454
+ maxDataLength: this.maxIdentifyMessageSize ?? MAX_IDENTIFY_MESSAGE_SIZE
455
+ })
456
+ const message = await pb.readPB(Identify)
457
+
458
+ await this.#consumeIdentifyMessage(connection.remotePeer, message)
459
+ } catch (err: any) {
460
+ log.error('received invalid message', err)
461
+ return
462
+ } finally {
463
+ stream.close()
464
+ }
465
+
466
+ log('handled push from %p', connection.remotePeer)
467
+ }
468
+
469
+ async #consumeIdentifyMessage (remotePeer: PeerId, message: Identify): Promise<void> {
470
+ if (message == null) {
471
+ throw new Error('Message was null or undefined')
472
+ }
473
+
474
+ log('received identify from %p', remotePeer)
475
+
476
+ if (message.signedPeerRecord == null) {
477
+ return
478
+ }
479
+
480
+ const envelope = await RecordEnvelope.openAndCertify(message.signedPeerRecord, PeerRecord.DOMAIN)
481
+ const peerRecord = PeerRecord.createFromProtobuf(envelope.payload)
482
+
483
+ // Verify peerId
484
+ if (!peerRecord.peerId.equals(envelope.peerId)) {
485
+ throw new Error('signing key does not match PeerId in the PeerRecord')
486
+ }
487
+
488
+ // Make sure remote peer is the one sending the record
489
+ if (!remotePeer.equals(peerRecord.peerId)) {
490
+ throw new Error('signing key does not match remote PeerId')
491
+ }
492
+
493
+ let peer: Peer | undefined
494
+
495
+ try {
496
+ peer = await this.peerStore.get(peerRecord.peerId)
497
+ } catch (err: any) {
498
+ if (err.code !== 'ERR_NOT_FOUND') {
499
+ throw err
500
+ }
501
+ }
502
+
503
+ log('received signedPeerRecord in push from %p', remotePeer)
504
+ let metadata = new Map()
505
+
506
+ if (peer?.peerRecordEnvelope != null) {
507
+ const storedEnvelope = await RecordEnvelope.createFromProtobuf(peer.peerRecordEnvelope)
508
+ const storedRecord = PeerRecord.createFromProtobuf(storedEnvelope.payload)
509
+
510
+ // ensure seq is greater than, or equal to, the last received
511
+ if (storedRecord.seqNumber >= peerRecord.seqNumber) {
512
+ log('sequence number was lower or equal to existing sequence number - stored: %d received: %d', storedRecord.seqNumber, peerRecord.seqNumber)
513
+ }
514
+
515
+ metadata = peer.metadata
516
+ }
517
+
518
+ if (message.agentVersion != null) {
519
+ metadata.set('AgentVersion', uint8ArrayFromString(message.agentVersion))
520
+ }
521
+
522
+ if (message.protocolVersion != null) {
523
+ metadata.set('ProtocolVersion', uint8ArrayFromString(message.protocolVersion))
524
+ }
525
+
526
+ await this.peerStore.patch(peerRecord.peerId, {
527
+ peerRecordEnvelope: message.signedPeerRecord,
528
+ protocols: message.protocols,
529
+ addresses: peerRecord.multiaddrs.map(multiaddr => ({
530
+ isCertified: true,
531
+ multiaddr
532
+ })),
533
+ metadata
534
+ })
535
+
536
+ log('consumed signedPeerRecord sent in push from %p', remotePeer)
537
+ }
538
+ }
539
+
540
+ /**
541
+ * Takes the `addr` and converts it to a Multiaddr if possible
542
+ */
543
+ function getCleanMultiaddr (addr: Uint8Array | string | null | undefined): Multiaddr | undefined {
544
+ if (addr != null && addr.length > 0) {
545
+ try {
546
+ return multiaddr(addr)
547
+ } catch {
548
+
549
+ }
550
+ }
551
+ }
552
+
53
553
  /**
54
554
  * The protocols the IdentifyService supports
55
555
  */
@@ -60,6 +560,6 @@ export const multicodecs = {
60
560
 
61
561
  export const Message = { Identify }
62
562
 
63
- export function identifyService (init: IdentifyServiceInit = {}): (components: IdentifyServiceComponents) => {} {
563
+ export function identifyService (init: IdentifyServiceInit = {}): (components: IdentifyServiceComponents) => IdentifyService {
64
564
  return (components) => new DefaultIdentifyService(components, init)
65
565
  }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
- export const version = '0.44.0-cd67b7d8'
1
+ export const version = '0.44.0-ed2fa794'
2
2
  export const name = 'libp2p'
@@ -1,53 +0,0 @@
1
- import { Identify } from './pb/message.js';
2
- import type { IncomingStreamData } from '@libp2p/interface-registrar';
3
- import type { Connection } from '@libp2p/interface-connection';
4
- import type { Startable } from '@libp2p/interfaces/startable';
5
- import type { AbortOptions } from '@libp2p/interfaces';
6
- import type { IdentifyServiceComponents, IdentifyServiceInit } from './index.js';
7
- export declare class DefaultIdentifyService implements Startable {
8
- #private;
9
- private readonly identifyProtocolStr;
10
- private readonly identifyPushProtocolStr;
11
- readonly host: {
12
- protocolVersion: string;
13
- agentVersion: string;
14
- };
15
- private started;
16
- private readonly timeout;
17
- private readonly peerId;
18
- private readonly peerStore;
19
- private readonly registrar;
20
- private readonly connectionManager;
21
- private readonly addressManager;
22
- private readonly maxInboundStreams;
23
- private readonly maxOutboundStreams;
24
- private readonly maxPushIncomingStreams;
25
- private readonly maxPushOutgoingStreams;
26
- private readonly maxIdentifyMessageSize;
27
- private readonly maxObservedAddresses;
28
- private readonly events;
29
- constructor(components: IdentifyServiceComponents, init: IdentifyServiceInit);
30
- isStarted(): boolean;
31
- start(): Promise<void>;
32
- stop(): Promise<void>;
33
- /**
34
- * Send an Identify Push update to the list of connections
35
- */
36
- pushToConnections(connections: Connection[]): Promise<void>;
37
- /**
38
- * Calls `push` on all peer connections
39
- */
40
- push(): Promise<void>;
41
- _identify(connection: Connection, options?: AbortOptions): Promise<Identify>;
42
- identify(connection: Connection, options?: AbortOptions): Promise<void>;
43
- /**
44
- * Sends the `Identify` response with the Signed Peer Record
45
- * to the requesting peer over the given `connection`
46
- */
47
- _handleIdentify(data: IncomingStreamData): Promise<void>;
48
- /**
49
- * Reads the Identify Push message from the given `connection`
50
- */
51
- _handlePush(data: IncomingStreamData): Promise<void>;
52
- }
53
- //# sourceMappingURL=identify.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"identify.d.ts","sourceRoot":"","sources":["../../../src/identify/identify.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAW1C,OAAO,KAAK,EAAE,kBAAkB,EAAa,MAAM,6BAA6B,CAAA;AAChF,OAAO,KAAK,EAAE,UAAU,EAAU,MAAM,8BAA8B,CAAA;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAE7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAWtD,OAAO,KAAK,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAsBhF,qBAAa,sBAAuB,YAAW,SAAS;;IACtD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAQ;IAC5C,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAQ;IAChD,SAAgB,IAAI,EAAE;QACpB,eAAe,EAAE,MAAM,CAAA;QACvB,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;IAED,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAW;IACrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAW;IACrC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IACrD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgB;IAC/C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAQ;IAC1C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAQ;IAC3C,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAQ;IAC/C,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAQ;IAC/C,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAQ;IAC/C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAQ;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4B;gBAEtC,UAAU,EAAE,yBAAyB,EAAE,IAAI,EAAE,mBAAmB;IA8C7E,SAAS,IAAK,OAAO;IAIf,KAAK,IAAK,OAAO,CAAC,IAAI,CAAC;IAgCvB,IAAI,IAAK,OAAO,CAAC,IAAI,CAAC;IAO5B;;OAEG;IACG,iBAAiB,CAAE,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAqDlE;;OAEG;IACG,IAAI,IAAK,OAAO,CAAC,IAAI,CAAC;IA6BtB,SAAS,CAAE,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC;IA4CjF,QAAQ,CAAE,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkDlF;;;OAGG;IACG,eAAe,CAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgD/D;;OAEG;IACG,WAAW,CAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CAoG5D"}