@libp2p/peer-record 1.0.6 → 1.0.9
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.
- package/dist/src/envelope/envelope.d.ts +11 -75
- package/dist/src/envelope/envelope.d.ts.map +1 -0
- package/dist/src/envelope/envelope.js +18 -238
- package/dist/src/envelope/envelope.js.map +1 -0
- package/dist/src/envelope/index.d.ts.map +1 -1
- package/dist/src/envelope/index.js +4 -1
- package/dist/src/envelope/index.js.map +1 -1
- package/dist/src/peer-record/index.d.ts +2 -2
- package/dist/src/peer-record/index.js +4 -4
- package/dist/src/peer-record/index.js.map +1 -1
- package/dist/src/peer-record/peer-record.d.ts +16 -129
- package/dist/src/peer-record/peer-record.d.ts.map +1 -0
- package/dist/src/peer-record/peer-record.js +31 -362
- package/dist/src/peer-record/peer-record.js.map +1 -0
- package/package.json +22 -25
- package/src/envelope/envelope.ts +31 -0
- package/src/envelope/index.ts +5 -1
- package/src/peer-record/index.ts +6 -6
- package/src/peer-record/peer-record.ts +49 -0
- package/src/envelope/envelope.d.ts +0 -77
- package/src/envelope/envelope.js +0 -241
- package/src/peer-record/peer-record.d.ts +0 -133
- package/src/peer-record/peer-record.js +0 -365
|
@@ -1,77 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/** Envelope payloadType */
|
|
9
|
-
payloadType?: (Uint8Array|null);
|
|
10
|
-
|
|
11
|
-
/** Envelope payload */
|
|
12
|
-
payload?: (Uint8Array|null);
|
|
13
|
-
|
|
14
|
-
/** Envelope signature */
|
|
15
|
-
signature?: (Uint8Array|null);
|
|
1
|
+
import type { Codec } from 'protons-runtime';
|
|
2
|
+
export interface Envelope {
|
|
3
|
+
publicKey: Uint8Array;
|
|
4
|
+
payloadType: Uint8Array;
|
|
5
|
+
payload: Uint8Array;
|
|
6
|
+
signature: Uint8Array;
|
|
16
7
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Constructs a new Envelope.
|
|
23
|
-
* @param [p] Properties to set
|
|
24
|
-
*/
|
|
25
|
-
constructor(p?: IEnvelope);
|
|
26
|
-
|
|
27
|
-
/** Envelope publicKey. */
|
|
28
|
-
public publicKey: Uint8Array;
|
|
29
|
-
|
|
30
|
-
/** Envelope payloadType. */
|
|
31
|
-
public payloadType: Uint8Array;
|
|
32
|
-
|
|
33
|
-
/** Envelope payload. */
|
|
34
|
-
public payload: Uint8Array;
|
|
35
|
-
|
|
36
|
-
/** Envelope signature. */
|
|
37
|
-
public signature: Uint8Array;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Encodes the specified Envelope message. Does not implicitly {@link Envelope.verify|verify} messages.
|
|
41
|
-
* @param m Envelope message or plain object to encode
|
|
42
|
-
* @param [w] Writer to encode to
|
|
43
|
-
* @returns Writer
|
|
44
|
-
*/
|
|
45
|
-
public static encode(m: IEnvelope, w?: $protobuf.Writer): $protobuf.Writer;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Decodes an Envelope message from the specified reader or buffer.
|
|
49
|
-
* @param r Reader or buffer to decode from
|
|
50
|
-
* @param [l] Message length if known beforehand
|
|
51
|
-
* @returns Envelope
|
|
52
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
53
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
54
|
-
*/
|
|
55
|
-
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): Envelope;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Creates an Envelope message from a plain object. Also converts values to their respective internal types.
|
|
59
|
-
* @param d Plain object
|
|
60
|
-
* @returns Envelope
|
|
61
|
-
*/
|
|
62
|
-
public static fromObject(d: { [k: string]: any }): Envelope;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Creates a plain object from an Envelope message. Also converts values to other types if specified.
|
|
66
|
-
* @param m Envelope
|
|
67
|
-
* @param [o] Conversion options
|
|
68
|
-
* @returns Plain object
|
|
69
|
-
*/
|
|
70
|
-
public static toObject(m: Envelope, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Converts this Envelope to JSON.
|
|
74
|
-
* @returns JSON object
|
|
75
|
-
*/
|
|
76
|
-
public toJSON(): { [k: string]: any };
|
|
8
|
+
export declare namespace Envelope {
|
|
9
|
+
const codec: () => Codec<Envelope>;
|
|
10
|
+
const encode: (obj: Envelope) => Uint8Array;
|
|
11
|
+
const decode: (buf: Uint8Array) => Envelope;
|
|
77
12
|
}
|
|
13
|
+
//# sourceMappingURL=envelope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../../src/envelope/envelope.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,UAAU,CAAA;IACrB,WAAW,EAAE,UAAU,CAAA;IACvB,OAAO,EAAE,UAAU,CAAA;IACnB,SAAS,EAAE,UAAU,CAAA;CACtB;AAED,yBAAiB,QAAQ,CAAC;IACjB,MAAM,KAAK,QAAO,MAAM,QAAQ,CAOtC,CAAA;IAEM,MAAM,MAAM,QAAS,QAAQ,KAAG,UAEtC,CAAA;IAEM,MAAM,MAAM,QAAS,UAAU,KAAG,QAExC,CAAA;CACF"}
|
|
@@ -1,241 +1,21 @@
|
|
|
1
|
-
/*eslint-disable*/
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* Properties of an Envelope.
|
|
14
|
-
* @exports IEnvelope
|
|
15
|
-
* @interface IEnvelope
|
|
16
|
-
* @property {Uint8Array|null} [publicKey] Envelope publicKey
|
|
17
|
-
* @property {Uint8Array|null} [payloadType] Envelope payloadType
|
|
18
|
-
* @property {Uint8Array|null} [payload] Envelope payload
|
|
19
|
-
* @property {Uint8Array|null} [signature] Envelope signature
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Constructs a new Envelope.
|
|
24
|
-
* @exports Envelope
|
|
25
|
-
* @classdesc Represents an Envelope.
|
|
26
|
-
* @implements IEnvelope
|
|
27
|
-
* @constructor
|
|
28
|
-
* @param {IEnvelope=} [p] Properties to set
|
|
29
|
-
*/
|
|
30
|
-
function Envelope(p) {
|
|
31
|
-
if (p)
|
|
32
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
33
|
-
if (p[ks[i]] != null)
|
|
34
|
-
this[ks[i]] = p[ks[i]];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Envelope publicKey.
|
|
39
|
-
* @member {Uint8Array} publicKey
|
|
40
|
-
* @memberof Envelope
|
|
41
|
-
* @instance
|
|
42
|
-
*/
|
|
43
|
-
Envelope.prototype.publicKey = $util.newBuffer([]);
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Envelope payloadType.
|
|
47
|
-
* @member {Uint8Array} payloadType
|
|
48
|
-
* @memberof Envelope
|
|
49
|
-
* @instance
|
|
50
|
-
*/
|
|
51
|
-
Envelope.prototype.payloadType = $util.newBuffer([]);
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Envelope payload.
|
|
55
|
-
* @member {Uint8Array} payload
|
|
56
|
-
* @memberof Envelope
|
|
57
|
-
* @instance
|
|
58
|
-
*/
|
|
59
|
-
Envelope.prototype.payload = $util.newBuffer([]);
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Envelope signature.
|
|
63
|
-
* @member {Uint8Array} signature
|
|
64
|
-
* @memberof Envelope
|
|
65
|
-
* @instance
|
|
66
|
-
*/
|
|
67
|
-
Envelope.prototype.signature = $util.newBuffer([]);
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Encodes the specified Envelope message. Does not implicitly {@link Envelope.verify|verify} messages.
|
|
71
|
-
* @function encode
|
|
72
|
-
* @memberof Envelope
|
|
73
|
-
* @static
|
|
74
|
-
* @param {IEnvelope} m Envelope message or plain object to encode
|
|
75
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
|
76
|
-
* @returns {$protobuf.Writer} Writer
|
|
77
|
-
*/
|
|
78
|
-
Envelope.encode = function encode(m, w) {
|
|
79
|
-
if (!w)
|
|
80
|
-
w = $Writer.create();
|
|
81
|
-
if (m.publicKey != null && Object.hasOwnProperty.call(m, "publicKey"))
|
|
82
|
-
w.uint32(10).bytes(m.publicKey);
|
|
83
|
-
if (m.payloadType != null && Object.hasOwnProperty.call(m, "payloadType"))
|
|
84
|
-
w.uint32(18).bytes(m.payloadType);
|
|
85
|
-
if (m.payload != null && Object.hasOwnProperty.call(m, "payload"))
|
|
86
|
-
w.uint32(26).bytes(m.payload);
|
|
87
|
-
if (m.signature != null && Object.hasOwnProperty.call(m, "signature"))
|
|
88
|
-
w.uint32(42).bytes(m.signature);
|
|
89
|
-
return w;
|
|
1
|
+
/* eslint-disable import/export */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-namespace */
|
|
3
|
+
import { encodeMessage, decodeMessage, message, bytes } from 'protons-runtime';
|
|
4
|
+
export var Envelope;
|
|
5
|
+
(function (Envelope) {
|
|
6
|
+
Envelope.codec = () => {
|
|
7
|
+
return message({
|
|
8
|
+
1: { name: 'publicKey', codec: bytes },
|
|
9
|
+
2: { name: 'payloadType', codec: bytes },
|
|
10
|
+
3: { name: 'payload', codec: bytes },
|
|
11
|
+
5: { name: 'signature', codec: bytes }
|
|
12
|
+
});
|
|
90
13
|
};
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
* Decodes an Envelope message from the specified reader or buffer.
|
|
94
|
-
* @function decode
|
|
95
|
-
* @memberof Envelope
|
|
96
|
-
* @static
|
|
97
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
|
98
|
-
* @param {number} [l] Message length if known beforehand
|
|
99
|
-
* @returns {Envelope} Envelope
|
|
100
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
101
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
102
|
-
*/
|
|
103
|
-
Envelope.decode = function decode(r, l) {
|
|
104
|
-
if (!(r instanceof $Reader))
|
|
105
|
-
r = $Reader.create(r);
|
|
106
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.Envelope();
|
|
107
|
-
while (r.pos < c) {
|
|
108
|
-
var t = r.uint32();
|
|
109
|
-
switch (t >>> 3) {
|
|
110
|
-
case 1:
|
|
111
|
-
m.publicKey = r.bytes();
|
|
112
|
-
break;
|
|
113
|
-
case 2:
|
|
114
|
-
m.payloadType = r.bytes();
|
|
115
|
-
break;
|
|
116
|
-
case 3:
|
|
117
|
-
m.payload = r.bytes();
|
|
118
|
-
break;
|
|
119
|
-
case 5:
|
|
120
|
-
m.signature = r.bytes();
|
|
121
|
-
break;
|
|
122
|
-
default:
|
|
123
|
-
r.skipType(t & 7);
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return m;
|
|
14
|
+
Envelope.encode = (obj) => {
|
|
15
|
+
return encodeMessage(obj, Envelope.codec());
|
|
128
16
|
};
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
* Creates an Envelope message from a plain object. Also converts values to their respective internal types.
|
|
132
|
-
* @function fromObject
|
|
133
|
-
* @memberof Envelope
|
|
134
|
-
* @static
|
|
135
|
-
* @param {Object.<string,*>} d Plain object
|
|
136
|
-
* @returns {Envelope} Envelope
|
|
137
|
-
*/
|
|
138
|
-
Envelope.fromObject = function fromObject(d) {
|
|
139
|
-
if (d instanceof $root.Envelope)
|
|
140
|
-
return d;
|
|
141
|
-
var m = new $root.Envelope();
|
|
142
|
-
if (d.publicKey != null) {
|
|
143
|
-
if (typeof d.publicKey === "string")
|
|
144
|
-
$util.base64.decode(d.publicKey, m.publicKey = $util.newBuffer($util.base64.length(d.publicKey)), 0);
|
|
145
|
-
else if (d.publicKey.length)
|
|
146
|
-
m.publicKey = d.publicKey;
|
|
147
|
-
}
|
|
148
|
-
if (d.payloadType != null) {
|
|
149
|
-
if (typeof d.payloadType === "string")
|
|
150
|
-
$util.base64.decode(d.payloadType, m.payloadType = $util.newBuffer($util.base64.length(d.payloadType)), 0);
|
|
151
|
-
else if (d.payloadType.length)
|
|
152
|
-
m.payloadType = d.payloadType;
|
|
153
|
-
}
|
|
154
|
-
if (d.payload != null) {
|
|
155
|
-
if (typeof d.payload === "string")
|
|
156
|
-
$util.base64.decode(d.payload, m.payload = $util.newBuffer($util.base64.length(d.payload)), 0);
|
|
157
|
-
else if (d.payload.length)
|
|
158
|
-
m.payload = d.payload;
|
|
159
|
-
}
|
|
160
|
-
if (d.signature != null) {
|
|
161
|
-
if (typeof d.signature === "string")
|
|
162
|
-
$util.base64.decode(d.signature, m.signature = $util.newBuffer($util.base64.length(d.signature)), 0);
|
|
163
|
-
else if (d.signature.length)
|
|
164
|
-
m.signature = d.signature;
|
|
165
|
-
}
|
|
166
|
-
return m;
|
|
17
|
+
Envelope.decode = (buf) => {
|
|
18
|
+
return decodeMessage(buf, Envelope.codec());
|
|
167
19
|
};
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
* Creates a plain object from an Envelope message. Also converts values to other types if specified.
|
|
171
|
-
* @function toObject
|
|
172
|
-
* @memberof Envelope
|
|
173
|
-
* @static
|
|
174
|
-
* @param {Envelope} m Envelope
|
|
175
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
|
176
|
-
* @returns {Object.<string,*>} Plain object
|
|
177
|
-
*/
|
|
178
|
-
Envelope.toObject = function toObject(m, o) {
|
|
179
|
-
if (!o)
|
|
180
|
-
o = {};
|
|
181
|
-
var d = {};
|
|
182
|
-
if (o.defaults) {
|
|
183
|
-
if (o.bytes === String)
|
|
184
|
-
d.publicKey = "";
|
|
185
|
-
else {
|
|
186
|
-
d.publicKey = [];
|
|
187
|
-
if (o.bytes !== Array)
|
|
188
|
-
d.publicKey = $util.newBuffer(d.publicKey);
|
|
189
|
-
}
|
|
190
|
-
if (o.bytes === String)
|
|
191
|
-
d.payloadType = "";
|
|
192
|
-
else {
|
|
193
|
-
d.payloadType = [];
|
|
194
|
-
if (o.bytes !== Array)
|
|
195
|
-
d.payloadType = $util.newBuffer(d.payloadType);
|
|
196
|
-
}
|
|
197
|
-
if (o.bytes === String)
|
|
198
|
-
d.payload = "";
|
|
199
|
-
else {
|
|
200
|
-
d.payload = [];
|
|
201
|
-
if (o.bytes !== Array)
|
|
202
|
-
d.payload = $util.newBuffer(d.payload);
|
|
203
|
-
}
|
|
204
|
-
if (o.bytes === String)
|
|
205
|
-
d.signature = "";
|
|
206
|
-
else {
|
|
207
|
-
d.signature = [];
|
|
208
|
-
if (o.bytes !== Array)
|
|
209
|
-
d.signature = $util.newBuffer(d.signature);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
if (m.publicKey != null && m.hasOwnProperty("publicKey")) {
|
|
213
|
-
d.publicKey = o.bytes === String ? $util.base64.encode(m.publicKey, 0, m.publicKey.length) : o.bytes === Array ? Array.prototype.slice.call(m.publicKey) : m.publicKey;
|
|
214
|
-
}
|
|
215
|
-
if (m.payloadType != null && m.hasOwnProperty("payloadType")) {
|
|
216
|
-
d.payloadType = o.bytes === String ? $util.base64.encode(m.payloadType, 0, m.payloadType.length) : o.bytes === Array ? Array.prototype.slice.call(m.payloadType) : m.payloadType;
|
|
217
|
-
}
|
|
218
|
-
if (m.payload != null && m.hasOwnProperty("payload")) {
|
|
219
|
-
d.payload = o.bytes === String ? $util.base64.encode(m.payload, 0, m.payload.length) : o.bytes === Array ? Array.prototype.slice.call(m.payload) : m.payload;
|
|
220
|
-
}
|
|
221
|
-
if (m.signature != null && m.hasOwnProperty("signature")) {
|
|
222
|
-
d.signature = o.bytes === String ? $util.base64.encode(m.signature, 0, m.signature.length) : o.bytes === Array ? Array.prototype.slice.call(m.signature) : m.signature;
|
|
223
|
-
}
|
|
224
|
-
return d;
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Converts this Envelope to JSON.
|
|
229
|
-
* @function toJSON
|
|
230
|
-
* @memberof Envelope
|
|
231
|
-
* @instance
|
|
232
|
-
* @returns {Object.<string,*>} JSON object
|
|
233
|
-
*/
|
|
234
|
-
Envelope.prototype.toJSON = function toJSON() {
|
|
235
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
return Envelope;
|
|
239
|
-
})();
|
|
240
|
-
|
|
241
|
-
export { $root as default };
|
|
20
|
+
})(Envelope || (Envelope = {}));
|
|
21
|
+
//# sourceMappingURL=envelope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../../src/envelope/envelope.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,oDAAoD;AAEpD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAU9E,MAAM,KAAW,QAAQ,CAiBxB;AAjBD,WAAiB,QAAQ;IACV,cAAK,GAAG,GAAoB,EAAE;QACzC,OAAO,OAAO,CAAW;YACvB,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE;YACtC,CAAC,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE;YACxC,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE;YACpC,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE;SACvC,CAAC,CAAA;IACJ,CAAC,CAAA;IAEY,eAAM,GAAG,CAAC,GAAa,EAAc,EAAE;QAClD,OAAO,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;IAC7C,CAAC,CAAA;IAEY,eAAM,GAAG,CAAC,GAAe,EAAY,EAAE;QAClD,OAAO,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;IAC7C,CAAC,CAAA;AACH,CAAC,EAjBgB,QAAQ,KAAR,QAAQ,QAiBxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/envelope/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAEjE,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,UAAU,CAAA;IACvB,OAAO,EAAE,UAAU,CAAA;IACnB,SAAS,EAAE,UAAU,CAAA;CACtB;AAED,qBAAa,cAAe,YAAW,QAAQ;IAC7C;;OAEG;IACH,MAAM,CAAC,kBAAkB,SAAgB,UAAU,6BAUlD;IAED;;;OAGG;IACH,MAAM,CAAC,IAAI,WAAkB,MAAM,UAAU,MAAM,6BAoBlD;IAED;;;OAGG;IACH,MAAM,CAAC,cAAc,SAAgB,UAAU,UAAU,MAAM,6BAS9D;IAEM,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,UAAU,CAAA;IACvB,OAAO,EAAE,UAAU,CAAA;IACnB,SAAS,EAAE,UAAU,CAAA;IACrB,SAAS,CAAC,EAAE,UAAU,CAAA;IAE7B;;;OAGG;gBACU,IAAI,EAAE,YAAY;IAS/B;;OAEG;IACH,OAAO;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/envelope/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAEjE,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,UAAU,CAAA;IACvB,OAAO,EAAE,UAAU,CAAA;IACnB,SAAS,EAAE,UAAU,CAAA;CACtB;AAED,qBAAa,cAAe,YAAW,QAAQ;IAC7C;;OAEG;IACH,MAAM,CAAC,kBAAkB,SAAgB,UAAU,6BAUlD;IAED;;;OAGG;IACH,MAAM,CAAC,IAAI,WAAkB,MAAM,UAAU,MAAM,6BAoBlD;IAED;;;OAGG;IACH,MAAM,CAAC,cAAc,SAAgB,UAAU,UAAU,MAAM,6BAS9D;IAEM,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,UAAU,CAAA;IACvB,OAAO,EAAE,UAAU,CAAA;IACnB,SAAS,EAAE,UAAU,CAAA;IACrB,SAAS,CAAC,EAAE,UAAU,CAAA;IAE7B;;;OAGG;gBACU,IAAI,EAAE,YAAY;IAS/B;;OAEG;IACH,OAAO;IAiBP;;OAEG;IACH,MAAM,CAAE,KAAK,EAAE,QAAQ;IAIvB;;OAEG;IACG,QAAQ,CAAE,MAAM,EAAE,MAAM;CAW/B"}
|
|
@@ -24,13 +24,16 @@ export class RecordEnvelope {
|
|
|
24
24
|
* Marshal the envelope content
|
|
25
25
|
*/
|
|
26
26
|
marshal() {
|
|
27
|
+
if (this.peerId.publicKey == null) {
|
|
28
|
+
throw new Error('Missing public key');
|
|
29
|
+
}
|
|
27
30
|
if (this.marshaled == null) {
|
|
28
31
|
this.marshaled = Protobuf.encode({
|
|
29
32
|
publicKey: this.peerId.publicKey,
|
|
30
33
|
payloadType: this.payloadType,
|
|
31
34
|
payload: this.payload,
|
|
32
35
|
signature: this.signature
|
|
33
|
-
})
|
|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;IAEnC,MAAM,gBAAgB,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAA;IACtD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAA;IAC/D,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;IAC3D,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IAEnD,OAAO,iBAAiB,CAAC;QACvB,IAAI,UAAU,CAAC,YAAY,CAAC;QAC5B,gBAAgB;QAChB,IAAI,UAAU,CAAC,iBAAiB,CAAC;QACjC,WAAW;QACX,IAAI,UAAU,CAAC,aAAa,CAAC;QAC7B,OAAO;KACR,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -9,7 +9,7 @@ export interface PeerRecordInit {
|
|
|
9
9
|
/**
|
|
10
10
|
* Monotonically-increasing sequence counter that's used to order PeerRecords in time.
|
|
11
11
|
*/
|
|
12
|
-
seqNumber?:
|
|
12
|
+
seqNumber?: bigint;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* The PeerRecord is used for distributing peer routing records across the network.
|
|
@@ -24,7 +24,7 @@ export declare class PeerRecord {
|
|
|
24
24
|
static CODEC: Uint8Array;
|
|
25
25
|
peerId: PeerId;
|
|
26
26
|
multiaddrs: Multiaddr[];
|
|
27
|
-
seqNumber:
|
|
27
|
+
seqNumber: bigint;
|
|
28
28
|
domain: string;
|
|
29
29
|
codec: Uint8Array;
|
|
30
30
|
private marshaled?;
|
|
@@ -14,7 +14,7 @@ export class PeerRecord {
|
|
|
14
14
|
const { peerId, multiaddrs, seqNumber } = init;
|
|
15
15
|
this.peerId = peerId;
|
|
16
16
|
this.multiaddrs = multiaddrs ?? [];
|
|
17
|
-
this.seqNumber = seqNumber ?? Date.now();
|
|
17
|
+
this.seqNumber = seqNumber ?? BigInt(Date.now());
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Marshal a record to be used in an envelope
|
|
@@ -23,11 +23,11 @@ export class PeerRecord {
|
|
|
23
23
|
if (this.marshaled == null) {
|
|
24
24
|
this.marshaled = Protobuf.encode({
|
|
25
25
|
peerId: this.peerId.toBytes(),
|
|
26
|
-
seq: this.seqNumber,
|
|
26
|
+
seq: BigInt(this.seqNumber),
|
|
27
27
|
addresses: this.multiaddrs.map((m) => ({
|
|
28
28
|
multiaddr: m.bytes
|
|
29
29
|
}))
|
|
30
|
-
})
|
|
30
|
+
});
|
|
31
31
|
}
|
|
32
32
|
return this.marshaled;
|
|
33
33
|
}
|
|
@@ -60,7 +60,7 @@ PeerRecord.createFromProtobuf = (buf) => {
|
|
|
60
60
|
const peerRecord = Protobuf.decode(buf);
|
|
61
61
|
const peerId = peerIdFromBytes(peerRecord.peerId);
|
|
62
62
|
const multiaddrs = (peerRecord.addresses ?? []).map((a) => new Multiaddr(a.multiaddr));
|
|
63
|
-
const seqNumber =
|
|
63
|
+
const seqNumber = peerRecord.seq;
|
|
64
64
|
return new PeerRecord({ peerId, multiaddrs, seqNumber });
|
|
65
65
|
};
|
|
66
66
|
PeerRecord.DOMAIN = ENVELOPE_DOMAIN_PEER_RECORD;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/peer-record/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,UAAU,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EACL,2BAA2B,EAC3B,iCAAiC,EAClC,MAAM,aAAa,CAAA;AAgBpB;;;GAGG;AACH,MAAM,OAAO,UAAU;IAuBrB,YAAa,IAAoB;QAJ1B,WAAM,GAA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AAA;IAEhC,OAAO,IAAI,UAAU,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAA;AAC1D,CAAC,CAAA;AAEM,iBAAM,GAAG,2BAA2B,CAAA;AACpC,gBAAK,GAAG,iCAAiC,CAAA"}
|
|
@@ -1,133 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
peerId?: (Uint8Array|null);
|
|
7
|
-
|
|
8
|
-
/** PeerRecord seq */
|
|
9
|
-
seq?: (number|null);
|
|
10
|
-
|
|
11
|
-
/** PeerRecord addresses */
|
|
12
|
-
addresses?: (PeerRecord.IAddressInfo[]|null);
|
|
1
|
+
import type { Codec } from 'protons-runtime';
|
|
2
|
+
export interface PeerRecord {
|
|
3
|
+
peerId: Uint8Array;
|
|
4
|
+
seq: bigint;
|
|
5
|
+
addresses: PeerRecord.AddressInfo[];
|
|
13
6
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Constructs a new PeerRecord.
|
|
20
|
-
* @param [p] Properties to set
|
|
21
|
-
*/
|
|
22
|
-
constructor(p?: IPeerRecord);
|
|
23
|
-
|
|
24
|
-
/** PeerRecord peerId. */
|
|
25
|
-
public peerId: Uint8Array;
|
|
26
|
-
|
|
27
|
-
/** PeerRecord seq. */
|
|
28
|
-
public seq: number;
|
|
29
|
-
|
|
30
|
-
/** PeerRecord addresses. */
|
|
31
|
-
public addresses: PeerRecord.IAddressInfo[];
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Encodes the specified PeerRecord message. Does not implicitly {@link PeerRecord.verify|verify} messages.
|
|
35
|
-
* @param m PeerRecord message or plain object to encode
|
|
36
|
-
* @param [w] Writer to encode to
|
|
37
|
-
* @returns Writer
|
|
38
|
-
*/
|
|
39
|
-
public static encode(m: IPeerRecord, w?: $protobuf.Writer): $protobuf.Writer;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Decodes a PeerRecord message from the specified reader or buffer.
|
|
43
|
-
* @param r Reader or buffer to decode from
|
|
44
|
-
* @param [l] Message length if known beforehand
|
|
45
|
-
* @returns PeerRecord
|
|
46
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
47
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
48
|
-
*/
|
|
49
|
-
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): PeerRecord;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Creates a PeerRecord message from a plain object. Also converts values to their respective internal types.
|
|
53
|
-
* @param d Plain object
|
|
54
|
-
* @returns PeerRecord
|
|
55
|
-
*/
|
|
56
|
-
public static fromObject(d: { [k: string]: any }): PeerRecord;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Creates a plain object from a PeerRecord message. Also converts values to other types if specified.
|
|
60
|
-
* @param m PeerRecord
|
|
61
|
-
* @param [o] Conversion options
|
|
62
|
-
* @returns Plain object
|
|
63
|
-
*/
|
|
64
|
-
public static toObject(m: PeerRecord, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Converts this PeerRecord to JSON.
|
|
68
|
-
* @returns JSON object
|
|
69
|
-
*/
|
|
70
|
-
public toJSON(): { [k: string]: any };
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export namespace PeerRecord {
|
|
74
|
-
|
|
75
|
-
/** Properties of an AddressInfo. */
|
|
76
|
-
interface IAddressInfo {
|
|
77
|
-
|
|
78
|
-
/** AddressInfo multiaddr */
|
|
79
|
-
multiaddr?: (Uint8Array|null);
|
|
7
|
+
export declare namespace PeerRecord {
|
|
8
|
+
interface AddressInfo {
|
|
9
|
+
multiaddr: Uint8Array;
|
|
80
10
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Constructs a new AddressInfo.
|
|
87
|
-
* @param [p] Properties to set
|
|
88
|
-
*/
|
|
89
|
-
constructor(p?: PeerRecord.IAddressInfo);
|
|
90
|
-
|
|
91
|
-
/** AddressInfo multiaddr. */
|
|
92
|
-
public multiaddr: Uint8Array;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Encodes the specified AddressInfo message. Does not implicitly {@link PeerRecord.AddressInfo.verify|verify} messages.
|
|
96
|
-
* @param m AddressInfo message or plain object to encode
|
|
97
|
-
* @param [w] Writer to encode to
|
|
98
|
-
* @returns Writer
|
|
99
|
-
*/
|
|
100
|
-
public static encode(m: PeerRecord.IAddressInfo, w?: $protobuf.Writer): $protobuf.Writer;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Decodes an AddressInfo message from the specified reader or buffer.
|
|
104
|
-
* @param r Reader or buffer to decode from
|
|
105
|
-
* @param [l] Message length if known beforehand
|
|
106
|
-
* @returns AddressInfo
|
|
107
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
108
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
109
|
-
*/
|
|
110
|
-
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): PeerRecord.AddressInfo;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Creates an AddressInfo message from a plain object. Also converts values to their respective internal types.
|
|
114
|
-
* @param d Plain object
|
|
115
|
-
* @returns AddressInfo
|
|
116
|
-
*/
|
|
117
|
-
public static fromObject(d: { [k: string]: any }): PeerRecord.AddressInfo;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Creates a plain object from an AddressInfo message. Also converts values to other types if specified.
|
|
121
|
-
* @param m AddressInfo
|
|
122
|
-
* @param [o] Conversion options
|
|
123
|
-
* @returns Plain object
|
|
124
|
-
*/
|
|
125
|
-
public static toObject(m: PeerRecord.AddressInfo, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Converts this AddressInfo to JSON.
|
|
129
|
-
* @returns JSON object
|
|
130
|
-
*/
|
|
131
|
-
public toJSON(): { [k: string]: any };
|
|
11
|
+
namespace AddressInfo {
|
|
12
|
+
const codec: () => Codec<AddressInfo>;
|
|
13
|
+
const encode: (obj: AddressInfo) => Uint8Array;
|
|
14
|
+
const decode: (buf: Uint8Array) => AddressInfo;
|
|
132
15
|
}
|
|
16
|
+
const codec: () => Codec<PeerRecord>;
|
|
17
|
+
const encode: (obj: PeerRecord) => Uint8Array;
|
|
18
|
+
const decode: (buf: Uint8Array) => PeerRecord;
|
|
133
19
|
}
|
|
20
|
+
//# sourceMappingURL=peer-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peer-record.d.ts","sourceRoot":"","sources":["../../../src/peer-record/peer-record.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,UAAU,CAAA;IAClB,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,UAAU,CAAC,WAAW,EAAE,CAAA;CACpC;AAED,yBAAiB,UAAU,CAAC;IAC1B,UAAiB,WAAW;QAC1B,SAAS,EAAE,UAAU,CAAA;KACtB;IAED,UAAiB,WAAW,CAAC;QACpB,MAAM,KAAK,QAAO,MAAM,WAAW,CAIzC,CAAA;QAEM,MAAM,MAAM,QAAS,WAAW,KAAG,UAEzC,CAAA;QAEM,MAAM,MAAM,QAAS,UAAU,KAAG,WAExC,CAAA;KACF;IAEM,MAAM,KAAK,QAAO,MAAM,UAAU,CAMxC,CAAA;IAEM,MAAM,MAAM,QAAS,UAAU,KAAG,UAExC,CAAA;IAEM,MAAM,MAAM,QAAS,UAAU,KAAG,UAExC,CAAA;CACF"}
|