libp2p 0.36.2-cc60cfd → 0.36.2-fab4f13

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.
Files changed (98) hide show
  1. package/dist/src/circuit/circuit/hop.d.ts +3 -3
  2. package/dist/src/circuit/circuit/hop.d.ts.map +1 -1
  3. package/dist/src/circuit/circuit/hop.js +1 -1
  4. package/dist/src/circuit/circuit/hop.js.map +1 -1
  5. package/dist/src/circuit/circuit/stop.d.ts +3 -3
  6. package/dist/src/circuit/circuit/stop.d.ts.map +1 -1
  7. package/dist/src/circuit/circuit/stop.js.map +1 -1
  8. package/dist/src/circuit/circuit/stream-handler.d.ts +4 -4
  9. package/dist/src/circuit/circuit/stream-handler.d.ts.map +1 -1
  10. package/dist/src/circuit/circuit/stream-handler.js +2 -3
  11. package/dist/src/circuit/circuit/stream-handler.js.map +1 -1
  12. package/dist/src/circuit/circuit/utils.d.ts +2 -2
  13. package/dist/src/circuit/circuit/utils.d.ts.map +1 -1
  14. package/dist/src/circuit/circuit/utils.js.map +1 -1
  15. package/dist/src/circuit/pb/index.d.ts +42 -164
  16. package/dist/src/circuit/pb/index.d.ts.map +1 -0
  17. package/dist/src/circuit/pb/index.js +67 -523
  18. package/dist/src/circuit/pb/index.js.map +1 -0
  19. package/dist/src/dht/dummy-dht.d.ts +17 -0
  20. package/dist/src/dht/dummy-dht.d.ts.map +1 -0
  21. package/dist/src/dht/dummy-dht.js +39 -0
  22. package/dist/src/dht/dummy-dht.js.map +1 -0
  23. package/dist/src/dialer/index.d.ts.map +1 -1
  24. package/dist/src/dialer/index.js +0 -1
  25. package/dist/src/dialer/index.js.map +1 -1
  26. package/dist/src/errors.d.ts +2 -0
  27. package/dist/src/errors.d.ts.map +1 -1
  28. package/dist/src/errors.js +2 -0
  29. package/dist/src/errors.js.map +1 -1
  30. package/dist/src/fetch/index.d.ts.map +1 -1
  31. package/dist/src/fetch/index.js +5 -6
  32. package/dist/src/fetch/index.js.map +1 -1
  33. package/dist/src/fetch/pb/proto.d.ts +20 -128
  34. package/dist/src/fetch/pb/proto.d.ts.map +1 -0
  35. package/dist/src/fetch/pb/proto.js +44 -331
  36. package/dist/src/fetch/pb/proto.js.map +1 -0
  37. package/dist/src/identify/index.d.ts +4 -2
  38. package/dist/src/identify/index.d.ts.map +1 -1
  39. package/dist/src/identify/index.js +8 -8
  40. package/dist/src/identify/index.js.map +1 -1
  41. package/dist/src/identify/pb/message.d.ts +13 -108
  42. package/dist/src/identify/pb/message.d.ts.map +1 -0
  43. package/dist/src/identify/pb/message.js +21 -366
  44. package/dist/src/identify/pb/message.js.map +1 -0
  45. package/dist/src/index.d.ts +11 -4
  46. package/dist/src/index.d.ts.map +1 -1
  47. package/dist/src/index.js.map +1 -1
  48. package/dist/src/insecure/index.d.ts.map +1 -1
  49. package/dist/src/insecure/index.js +5 -2
  50. package/dist/src/insecure/index.js.map +1 -1
  51. package/dist/src/insecure/pb/proto.d.ts +24 -130
  52. package/dist/src/insecure/pb/proto.d.ts.map +1 -0
  53. package/dist/src/insecure/pb/proto.js +46 -388
  54. package/dist/src/insecure/pb/proto.js.map +1 -0
  55. package/dist/src/keychain/index.d.ts +3 -3
  56. package/dist/src/keychain/index.js +2 -2
  57. package/dist/src/keychain/util.d.ts +1 -1
  58. package/dist/src/keychain/util.d.ts.map +1 -1
  59. package/dist/src/libp2p.d.ts +7 -4
  60. package/dist/src/libp2p.d.ts.map +1 -1
  61. package/dist/src/libp2p.js +20 -5
  62. package/dist/src/libp2p.js.map +1 -1
  63. package/dist/src/metrics/stats.d.ts +1 -5
  64. package/dist/src/metrics/stats.d.ts.map +1 -1
  65. package/dist/src/metrics/stats.js.map +1 -1
  66. package/dist/src/pubsub/dummy-pubsub.d.ts +17 -0
  67. package/dist/src/pubsub/dummy-pubsub.d.ts.map +1 -0
  68. package/dist/src/pubsub/dummy-pubsub.js +37 -0
  69. package/dist/src/pubsub/dummy-pubsub.js.map +1 -0
  70. package/package.json +45 -44
  71. package/src/circuit/circuit/hop.ts +4 -4
  72. package/src/circuit/circuit/stop.ts +3 -3
  73. package/src/circuit/circuit/stream-handler.ts +5 -6
  74. package/src/circuit/circuit/utils.ts +2 -2
  75. package/src/circuit/pb/index.proto +1 -1
  76. package/src/circuit/pb/index.ts +88 -0
  77. package/src/dht/dummy-dht.ts +51 -0
  78. package/src/dialer/index.ts +0 -3
  79. package/src/errors.ts +2 -0
  80. package/src/fetch/index.ts +6 -7
  81. package/src/fetch/pb/proto.ts +58 -0
  82. package/src/identify/index.ts +10 -10
  83. package/src/identify/pb/message.ts +36 -0
  84. package/src/index.ts +12 -5
  85. package/src/insecure/index.ts +8 -4
  86. package/src/insecure/pb/proto.ts +61 -0
  87. package/src/keychain/index.ts +2 -2
  88. package/src/libp2p.ts +27 -9
  89. package/src/metrics/stats.ts +1 -6
  90. package/src/pubsub/dummy-pubsub.ts +51 -0
  91. package/src/circuit/pb/index.d.ts +0 -173
  92. package/src/circuit/pb/index.js +0 -528
  93. package/src/fetch/pb/proto.d.ts +0 -134
  94. package/src/fetch/pb/proto.js +0 -331
  95. package/src/identify/pb/message.d.ts +0 -110
  96. package/src/identify/pb/message.js +0 -369
  97. package/src/insecure/pb/proto.d.ts +0 -134
  98. package/src/insecure/pb/proto.js +0 -388
@@ -1,388 +0,0 @@
1
- /*eslint-disable*/
2
- import $protobuf from "protobufjs/minimal.js";
3
-
4
- // Common aliases
5
- const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
6
-
7
- // Exported root namespace
8
- const $root = $protobuf.roots["libp2p-plaintext"] || ($protobuf.roots["libp2p-plaintext"] = {});
9
-
10
- export const Exchange = $root.Exchange = (() => {
11
-
12
- /**
13
- * Properties of an Exchange.
14
- * @exports IExchange
15
- * @interface IExchange
16
- * @property {Uint8Array|null} [id] Exchange id
17
- * @property {IPublicKey|null} [pubkey] Exchange pubkey
18
- */
19
-
20
- /**
21
- * Constructs a new Exchange.
22
- * @exports Exchange
23
- * @classdesc Represents an Exchange.
24
- * @implements IExchange
25
- * @constructor
26
- * @param {IExchange=} [p] Properties to set
27
- */
28
- function Exchange(p) {
29
- if (p)
30
- for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
31
- if (p[ks[i]] != null)
32
- this[ks[i]] = p[ks[i]];
33
- }
34
-
35
- /**
36
- * Exchange id.
37
- * @member {Uint8Array|null|undefined} id
38
- * @memberof Exchange
39
- * @instance
40
- */
41
- Exchange.prototype.id = null;
42
-
43
- /**
44
- * Exchange pubkey.
45
- * @member {IPublicKey|null|undefined} pubkey
46
- * @memberof Exchange
47
- * @instance
48
- */
49
- Exchange.prototype.pubkey = null;
50
-
51
- // OneOf field names bound to virtual getters and setters
52
- let $oneOfFields;
53
-
54
- /**
55
- * Exchange _id.
56
- * @member {"id"|undefined} _id
57
- * @memberof Exchange
58
- * @instance
59
- */
60
- Object.defineProperty(Exchange.prototype, "_id", {
61
- get: $util.oneOfGetter($oneOfFields = ["id"]),
62
- set: $util.oneOfSetter($oneOfFields)
63
- });
64
-
65
- /**
66
- * Exchange _pubkey.
67
- * @member {"pubkey"|undefined} _pubkey
68
- * @memberof Exchange
69
- * @instance
70
- */
71
- Object.defineProperty(Exchange.prototype, "_pubkey", {
72
- get: $util.oneOfGetter($oneOfFields = ["pubkey"]),
73
- set: $util.oneOfSetter($oneOfFields)
74
- });
75
-
76
- /**
77
- * Encodes the specified Exchange message. Does not implicitly {@link Exchange.verify|verify} messages.
78
- * @function encode
79
- * @memberof Exchange
80
- * @static
81
- * @param {IExchange} m Exchange message or plain object to encode
82
- * @param {$protobuf.Writer} [w] Writer to encode to
83
- * @returns {$protobuf.Writer} Writer
84
- */
85
- Exchange.encode = function encode(m, w) {
86
- if (!w)
87
- w = $Writer.create();
88
- if (m.id != null && Object.hasOwnProperty.call(m, "id"))
89
- w.uint32(10).bytes(m.id);
90
- if (m.pubkey != null && Object.hasOwnProperty.call(m, "pubkey"))
91
- $root.PublicKey.encode(m.pubkey, w.uint32(18).fork()).ldelim();
92
- return w;
93
- };
94
-
95
- /**
96
- * Decodes an Exchange message from the specified reader or buffer.
97
- * @function decode
98
- * @memberof Exchange
99
- * @static
100
- * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
101
- * @param {number} [l] Message length if known beforehand
102
- * @returns {Exchange} Exchange
103
- * @throws {Error} If the payload is not a reader or valid buffer
104
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
105
- */
106
- Exchange.decode = function decode(r, l) {
107
- if (!(r instanceof $Reader))
108
- r = $Reader.create(r);
109
- var c = l === undefined ? r.len : r.pos + l, m = new $root.Exchange();
110
- while (r.pos < c) {
111
- var t = r.uint32();
112
- switch (t >>> 3) {
113
- case 1:
114
- m.id = r.bytes();
115
- break;
116
- case 2:
117
- m.pubkey = $root.PublicKey.decode(r, r.uint32());
118
- break;
119
- default:
120
- r.skipType(t & 7);
121
- break;
122
- }
123
- }
124
- return m;
125
- };
126
-
127
- /**
128
- * Creates an Exchange message from a plain object. Also converts values to their respective internal types.
129
- * @function fromObject
130
- * @memberof Exchange
131
- * @static
132
- * @param {Object.<string,*>} d Plain object
133
- * @returns {Exchange} Exchange
134
- */
135
- Exchange.fromObject = function fromObject(d) {
136
- if (d instanceof $root.Exchange)
137
- return d;
138
- var m = new $root.Exchange();
139
- if (d.id != null) {
140
- if (typeof d.id === "string")
141
- $util.base64.decode(d.id, m.id = $util.newBuffer($util.base64.length(d.id)), 0);
142
- else if (d.id.length)
143
- m.id = d.id;
144
- }
145
- if (d.pubkey != null) {
146
- if (typeof d.pubkey !== "object")
147
- throw TypeError(".Exchange.pubkey: object expected");
148
- m.pubkey = $root.PublicKey.fromObject(d.pubkey);
149
- }
150
- return m;
151
- };
152
-
153
- /**
154
- * Creates a plain object from an Exchange message. Also converts values to other types if specified.
155
- * @function toObject
156
- * @memberof Exchange
157
- * @static
158
- * @param {Exchange} m Exchange
159
- * @param {$protobuf.IConversionOptions} [o] Conversion options
160
- * @returns {Object.<string,*>} Plain object
161
- */
162
- Exchange.toObject = function toObject(m, o) {
163
- if (!o)
164
- o = {};
165
- var d = {};
166
- if (m.id != null && m.hasOwnProperty("id")) {
167
- d.id = o.bytes === String ? $util.base64.encode(m.id, 0, m.id.length) : o.bytes === Array ? Array.prototype.slice.call(m.id) : m.id;
168
- if (o.oneofs)
169
- d._id = "id";
170
- }
171
- if (m.pubkey != null && m.hasOwnProperty("pubkey")) {
172
- d.pubkey = $root.PublicKey.toObject(m.pubkey, o);
173
- if (o.oneofs)
174
- d._pubkey = "pubkey";
175
- }
176
- return d;
177
- };
178
-
179
- /**
180
- * Converts this Exchange to JSON.
181
- * @function toJSON
182
- * @memberof Exchange
183
- * @instance
184
- * @returns {Object.<string,*>} JSON object
185
- */
186
- Exchange.prototype.toJSON = function toJSON() {
187
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
188
- };
189
-
190
- return Exchange;
191
- })();
192
-
193
- /**
194
- * KeyType enum.
195
- * @exports KeyType
196
- * @enum {number}
197
- * @property {number} RSA=0 RSA value
198
- * @property {number} Ed25519=1 Ed25519 value
199
- * @property {number} Secp256k1=2 Secp256k1 value
200
- * @property {number} ECDSA=3 ECDSA value
201
- */
202
- export const KeyType = $root.KeyType = (() => {
203
- const valuesById = {}, values = Object.create(valuesById);
204
- values[valuesById[0] = "RSA"] = 0;
205
- values[valuesById[1] = "Ed25519"] = 1;
206
- values[valuesById[2] = "Secp256k1"] = 2;
207
- values[valuesById[3] = "ECDSA"] = 3;
208
- return values;
209
- })();
210
-
211
- export const PublicKey = $root.PublicKey = (() => {
212
-
213
- /**
214
- * Properties of a PublicKey.
215
- * @exports IPublicKey
216
- * @interface IPublicKey
217
- * @property {KeyType|null} [Type] PublicKey Type
218
- * @property {Uint8Array|null} [Data] PublicKey Data
219
- */
220
-
221
- /**
222
- * Constructs a new PublicKey.
223
- * @exports PublicKey
224
- * @classdesc Represents a PublicKey.
225
- * @implements IPublicKey
226
- * @constructor
227
- * @param {IPublicKey=} [p] Properties to set
228
- */
229
- function PublicKey(p) {
230
- if (p)
231
- for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
232
- if (p[ks[i]] != null)
233
- this[ks[i]] = p[ks[i]];
234
- }
235
-
236
- /**
237
- * PublicKey Type.
238
- * @member {KeyType} Type
239
- * @memberof PublicKey
240
- * @instance
241
- */
242
- PublicKey.prototype.Type = 0;
243
-
244
- /**
245
- * PublicKey Data.
246
- * @member {Uint8Array} Data
247
- * @memberof PublicKey
248
- * @instance
249
- */
250
- PublicKey.prototype.Data = $util.newBuffer([]);
251
-
252
- /**
253
- * Encodes the specified PublicKey message. Does not implicitly {@link PublicKey.verify|verify} messages.
254
- * @function encode
255
- * @memberof PublicKey
256
- * @static
257
- * @param {IPublicKey} m PublicKey message or plain object to encode
258
- * @param {$protobuf.Writer} [w] Writer to encode to
259
- * @returns {$protobuf.Writer} Writer
260
- */
261
- PublicKey.encode = function encode(m, w) {
262
- if (!w)
263
- w = $Writer.create();
264
- if (m.Type != null && Object.hasOwnProperty.call(m, "Type"))
265
- w.uint32(8).int32(m.Type);
266
- if (m.Data != null && Object.hasOwnProperty.call(m, "Data"))
267
- w.uint32(18).bytes(m.Data);
268
- return w;
269
- };
270
-
271
- /**
272
- * Decodes a PublicKey message from the specified reader or buffer.
273
- * @function decode
274
- * @memberof PublicKey
275
- * @static
276
- * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
277
- * @param {number} [l] Message length if known beforehand
278
- * @returns {PublicKey} PublicKey
279
- * @throws {Error} If the payload is not a reader or valid buffer
280
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
281
- */
282
- PublicKey.decode = function decode(r, l) {
283
- if (!(r instanceof $Reader))
284
- r = $Reader.create(r);
285
- var c = l === undefined ? r.len : r.pos + l, m = new $root.PublicKey();
286
- while (r.pos < c) {
287
- var t = r.uint32();
288
- switch (t >>> 3) {
289
- case 1:
290
- m.Type = r.int32();
291
- break;
292
- case 2:
293
- m.Data = r.bytes();
294
- break;
295
- default:
296
- r.skipType(t & 7);
297
- break;
298
- }
299
- }
300
- return m;
301
- };
302
-
303
- /**
304
- * Creates a PublicKey message from a plain object. Also converts values to their respective internal types.
305
- * @function fromObject
306
- * @memberof PublicKey
307
- * @static
308
- * @param {Object.<string,*>} d Plain object
309
- * @returns {PublicKey} PublicKey
310
- */
311
- PublicKey.fromObject = function fromObject(d) {
312
- if (d instanceof $root.PublicKey)
313
- return d;
314
- var m = new $root.PublicKey();
315
- switch (d.Type) {
316
- case "RSA":
317
- case 0:
318
- m.Type = 0;
319
- break;
320
- case "Ed25519":
321
- case 1:
322
- m.Type = 1;
323
- break;
324
- case "Secp256k1":
325
- case 2:
326
- m.Type = 2;
327
- break;
328
- case "ECDSA":
329
- case 3:
330
- m.Type = 3;
331
- break;
332
- }
333
- if (d.Data != null) {
334
- if (typeof d.Data === "string")
335
- $util.base64.decode(d.Data, m.Data = $util.newBuffer($util.base64.length(d.Data)), 0);
336
- else if (d.Data.length)
337
- m.Data = d.Data;
338
- }
339
- return m;
340
- };
341
-
342
- /**
343
- * Creates a plain object from a PublicKey message. Also converts values to other types if specified.
344
- * @function toObject
345
- * @memberof PublicKey
346
- * @static
347
- * @param {PublicKey} m PublicKey
348
- * @param {$protobuf.IConversionOptions} [o] Conversion options
349
- * @returns {Object.<string,*>} Plain object
350
- */
351
- PublicKey.toObject = function toObject(m, o) {
352
- if (!o)
353
- o = {};
354
- var d = {};
355
- if (o.defaults) {
356
- d.Type = o.enums === String ? "RSA" : 0;
357
- if (o.bytes === String)
358
- d.Data = "";
359
- else {
360
- d.Data = [];
361
- if (o.bytes !== Array)
362
- d.Data = $util.newBuffer(d.Data);
363
- }
364
- }
365
- if (m.Type != null && m.hasOwnProperty("Type")) {
366
- d.Type = o.enums === String ? $root.KeyType[m.Type] : m.Type;
367
- }
368
- if (m.Data != null && m.hasOwnProperty("Data")) {
369
- d.Data = o.bytes === String ? $util.base64.encode(m.Data, 0, m.Data.length) : o.bytes === Array ? Array.prototype.slice.call(m.Data) : m.Data;
370
- }
371
- return d;
372
- };
373
-
374
- /**
375
- * Converts this PublicKey to JSON.
376
- * @function toJSON
377
- * @memberof PublicKey
378
- * @instance
379
- * @returns {Object.<string,*>} JSON object
380
- */
381
- PublicKey.prototype.toJSON = function toJSON() {
382
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
383
- };
384
-
385
- return PublicKey;
386
- })();
387
-
388
- export { $root as default };