libp2p 0.36.2-64bfcee → 0.36.2-c64a586
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/circuit/circuit/hop.d.ts +3 -3
- package/dist/src/circuit/circuit/hop.d.ts.map +1 -1
- package/dist/src/circuit/circuit/hop.js +1 -1
- package/dist/src/circuit/circuit/hop.js.map +1 -1
- package/dist/src/circuit/circuit/stop.d.ts +3 -3
- package/dist/src/circuit/circuit/stop.d.ts.map +1 -1
- package/dist/src/circuit/circuit/stop.js.map +1 -1
- package/dist/src/circuit/circuit/stream-handler.d.ts +4 -4
- package/dist/src/circuit/circuit/stream-handler.d.ts.map +1 -1
- package/dist/src/circuit/circuit/stream-handler.js +2 -3
- package/dist/src/circuit/circuit/stream-handler.js.map +1 -1
- package/dist/src/circuit/circuit/utils.d.ts +2 -2
- package/dist/src/circuit/circuit/utils.d.ts.map +1 -1
- package/dist/src/circuit/circuit/utils.js.map +1 -1
- package/dist/src/circuit/pb/index.d.ts +42 -164
- package/dist/src/circuit/pb/index.d.ts.map +1 -0
- package/dist/src/circuit/pb/index.js +67 -523
- package/dist/src/circuit/pb/index.js.map +1 -0
- package/dist/src/fetch/index.d.ts.map +1 -1
- package/dist/src/fetch/index.js +5 -6
- package/dist/src/fetch/index.js.map +1 -1
- package/dist/src/fetch/pb/proto.d.ts +20 -128
- package/dist/src/fetch/pb/proto.d.ts.map +1 -0
- package/dist/src/fetch/pb/proto.js +44 -331
- package/dist/src/fetch/pb/proto.js.map +1 -0
- package/dist/src/identify/index.d.ts +4 -2
- package/dist/src/identify/index.d.ts.map +1 -1
- package/dist/src/identify/index.js +8 -8
- package/dist/src/identify/index.js.map +1 -1
- package/dist/src/identify/pb/message.d.ts +13 -108
- package/dist/src/identify/pb/message.d.ts.map +1 -0
- package/dist/src/identify/pb/message.js +21 -366
- package/dist/src/identify/pb/message.js.map +1 -0
- package/dist/src/insecure/index.d.ts.map +1 -1
- package/dist/src/insecure/index.js +5 -2
- package/dist/src/insecure/index.js.map +1 -1
- package/dist/src/insecure/pb/proto.d.ts +24 -130
- package/dist/src/insecure/pb/proto.d.ts.map +1 -0
- package/dist/src/insecure/pb/proto.js +46 -388
- package/dist/src/insecure/pb/proto.js.map +1 -0
- package/dist/src/keychain/index.d.ts +2 -2
- package/dist/src/keychain/index.js +2 -2
- package/dist/src/keychain/util.d.ts +1 -1
- package/dist/src/keychain/util.d.ts.map +1 -1
- package/package.json +24 -22
- package/src/circuit/circuit/hop.ts +4 -4
- package/src/circuit/circuit/stop.ts +3 -3
- package/src/circuit/circuit/stream-handler.ts +5 -6
- package/src/circuit/circuit/utils.ts +2 -2
- package/src/circuit/pb/index.proto +1 -1
- package/src/circuit/pb/index.ts +88 -0
- package/src/fetch/index.ts +6 -7
- package/src/fetch/pb/proto.ts +58 -0
- package/src/identify/index.ts +10 -10
- package/src/identify/pb/message.ts +36 -0
- package/src/insecure/index.ts +8 -4
- package/src/insecure/pb/proto.ts +61 -0
- package/src/keychain/index.ts +2 -2
- package/src/circuit/pb/index.d.ts +0 -173
- package/src/circuit/pb/index.js +0 -528
- package/src/fetch/pb/proto.d.ts +0 -134
- package/src/fetch/pb/proto.js +0 -331
- package/src/identify/pb/message.d.ts +0 -110
- package/src/identify/pb/message.js +0 -369
- package/src/insecure/pb/proto.d.ts +0 -134
- package/src/insecure/pb/proto.js +0 -388
|
@@ -1,134 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/** Exchange id */
|
|
6
|
-
id?: (Uint8Array|null);
|
|
7
|
-
|
|
8
|
-
/** Exchange pubkey */
|
|
9
|
-
pubkey?: (IPublicKey|null);
|
|
1
|
+
export interface Exchange {
|
|
2
|
+
id?: Uint8Array;
|
|
3
|
+
pubkey?: PublicKey;
|
|
10
4
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Constructs a new Exchange.
|
|
17
|
-
* @param [p] Properties to set
|
|
18
|
-
*/
|
|
19
|
-
constructor(p?: IExchange);
|
|
20
|
-
|
|
21
|
-
/** Exchange id. */
|
|
22
|
-
public id?: (Uint8Array|null);
|
|
23
|
-
|
|
24
|
-
/** Exchange pubkey. */
|
|
25
|
-
public pubkey?: (IPublicKey|null);
|
|
26
|
-
|
|
27
|
-
/** Exchange _id. */
|
|
28
|
-
public _id?: "id";
|
|
29
|
-
|
|
30
|
-
/** Exchange _pubkey. */
|
|
31
|
-
public _pubkey?: "pubkey";
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Encodes the specified Exchange message. Does not implicitly {@link Exchange.verify|verify} messages.
|
|
35
|
-
* @param m Exchange message or plain object to encode
|
|
36
|
-
* @param [w] Writer to encode to
|
|
37
|
-
* @returns Writer
|
|
38
|
-
*/
|
|
39
|
-
public static encode(m: IExchange, w?: $protobuf.Writer): $protobuf.Writer;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Decodes an Exchange 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 Exchange
|
|
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): Exchange;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Creates an Exchange message from a plain object. Also converts values to their respective internal types.
|
|
53
|
-
* @param d Plain object
|
|
54
|
-
* @returns Exchange
|
|
55
|
-
*/
|
|
56
|
-
public static fromObject(d: { [k: string]: any }): Exchange;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Creates a plain object from an Exchange message. Also converts values to other types if specified.
|
|
60
|
-
* @param m Exchange
|
|
61
|
-
* @param [o] Conversion options
|
|
62
|
-
* @returns Plain object
|
|
63
|
-
*/
|
|
64
|
-
public static toObject(m: Exchange, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Converts this Exchange to JSON.
|
|
68
|
-
* @returns JSON object
|
|
69
|
-
*/
|
|
70
|
-
public toJSON(): { [k: string]: any };
|
|
5
|
+
export declare namespace Exchange {
|
|
6
|
+
const codec: () => import("protons-runtime/dist/src/codecs/codec").Codec<Exchange>;
|
|
7
|
+
const encode: (obj: Exchange) => Uint8Array;
|
|
8
|
+
const decode: (buf: Uint8Array) => Exchange;
|
|
71
9
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
Secp256k1 = 2,
|
|
78
|
-
ECDSA = 3
|
|
10
|
+
export declare enum KeyType {
|
|
11
|
+
RSA = "RSA",
|
|
12
|
+
Ed25519 = "Ed25519",
|
|
13
|
+
Secp256k1 = "Secp256k1",
|
|
14
|
+
ECDSA = "ECDSA"
|
|
79
15
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
export class PublicKey implements IPublicKey {
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Constructs a new PublicKey.
|
|
86
|
-
* @param [p] Properties to set
|
|
87
|
-
*/
|
|
88
|
-
constructor(p?: IPublicKey);
|
|
89
|
-
|
|
90
|
-
/** PublicKey Type. */
|
|
91
|
-
public Type: KeyType;
|
|
92
|
-
|
|
93
|
-
/** PublicKey Data. */
|
|
94
|
-
public Data: Uint8Array;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Encodes the specified PublicKey message. Does not implicitly {@link PublicKey.verify|verify} messages.
|
|
98
|
-
* @param m PublicKey message or plain object to encode
|
|
99
|
-
* @param [w] Writer to encode to
|
|
100
|
-
* @returns Writer
|
|
101
|
-
*/
|
|
102
|
-
public static encode(m: IPublicKey, w?: $protobuf.Writer): $protobuf.Writer;
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Decodes a PublicKey message from the specified reader or buffer.
|
|
106
|
-
* @param r Reader or buffer to decode from
|
|
107
|
-
* @param [l] Message length if known beforehand
|
|
108
|
-
* @returns PublicKey
|
|
109
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
|
110
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
111
|
-
*/
|
|
112
|
-
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): PublicKey;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Creates a PublicKey message from a plain object. Also converts values to their respective internal types.
|
|
116
|
-
* @param d Plain object
|
|
117
|
-
* @returns PublicKey
|
|
118
|
-
*/
|
|
119
|
-
public static fromObject(d: { [k: string]: any }): PublicKey;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Creates a plain object from a PublicKey message. Also converts values to other types if specified.
|
|
123
|
-
* @param m PublicKey
|
|
124
|
-
* @param [o] Conversion options
|
|
125
|
-
* @returns Plain object
|
|
126
|
-
*/
|
|
127
|
-
public static toObject(m: PublicKey, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Converts this PublicKey to JSON.
|
|
131
|
-
* @returns JSON object
|
|
132
|
-
*/
|
|
133
|
-
public toJSON(): { [k: string]: any };
|
|
16
|
+
export declare namespace KeyType {
|
|
17
|
+
const codec: () => import("protons-runtime/dist/src/codecs/codec").Codec<typeof KeyType>;
|
|
134
18
|
}
|
|
19
|
+
export interface PublicKey {
|
|
20
|
+
Type: KeyType;
|
|
21
|
+
Data: Uint8Array;
|
|
22
|
+
}
|
|
23
|
+
export declare namespace PublicKey {
|
|
24
|
+
const codec: () => import("protons-runtime/dist/src/codecs/codec").Codec<PublicKey>;
|
|
25
|
+
const encode: (obj: PublicKey) => Uint8Array;
|
|
26
|
+
const decode: (buf: Uint8Array) => PublicKey;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=proto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proto.d.ts","sourceRoot":"","sources":["../../../../src/insecure/pb/proto.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,QAAQ;IACvB,EAAE,CAAC,EAAE,UAAU,CAAA;IACf,MAAM,CAAC,EAAE,SAAS,CAAA;CACnB;AAED,yBAAiB,QAAQ,CAAC;IACjB,MAAM,KAAK,uEAKjB,CAAA;IAEM,MAAM,MAAM,QAAS,QAAQ,KAAG,UAEtC,CAAA;IAEM,MAAM,MAAM,QAAS,UAAU,KAAG,QAExC,CAAA;CACF;AAED,oBAAY,OAAO;IACjB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,KAAK,UAAU;CAChB;AAED,yBAAiB,OAAO,CAAC;IAChB,MAAM,KAAK,6EAEjB,CAAA;CACF;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,EAAE,UAAU,CAAA;CACjB;AAED,yBAAiB,SAAS,CAAC;IAClB,MAAM,KAAK,wEAKjB,CAAA;IAEM,MAAM,MAAM,QAAS,SAAS,KAAG,UAEvC,CAAA;IAEM,MAAM,MAAM,QAAS,UAAU,KAAG,SAExC,CAAA;CACF"}
|
|
@@ -1,388 +1,46 @@
|
|
|
1
|
-
/*eslint-disable*/
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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 };
|
|
1
|
+
/* eslint-disable import/export */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-namespace */
|
|
3
|
+
import { encodeMessage, decodeMessage, message, bytes, enumeration } from 'protons-runtime';
|
|
4
|
+
export var Exchange;
|
|
5
|
+
(function (Exchange) {
|
|
6
|
+
Exchange.codec = () => {
|
|
7
|
+
return message({
|
|
8
|
+
1: { name: 'id', codec: bytes, optional: true },
|
|
9
|
+
2: { name: 'pubkey', codec: PublicKey.codec(), optional: true }
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
Exchange.encode = (obj) => {
|
|
13
|
+
return encodeMessage(obj, Exchange.codec());
|
|
14
|
+
};
|
|
15
|
+
Exchange.decode = (buf) => {
|
|
16
|
+
return decodeMessage(buf, Exchange.codec());
|
|
17
|
+
};
|
|
18
|
+
})(Exchange || (Exchange = {}));
|
|
19
|
+
export var KeyType;
|
|
20
|
+
(function (KeyType) {
|
|
21
|
+
KeyType["RSA"] = "RSA";
|
|
22
|
+
KeyType["Ed25519"] = "Ed25519";
|
|
23
|
+
KeyType["Secp256k1"] = "Secp256k1";
|
|
24
|
+
KeyType["ECDSA"] = "ECDSA";
|
|
25
|
+
})(KeyType || (KeyType = {}));
|
|
26
|
+
(function (KeyType) {
|
|
27
|
+
KeyType.codec = () => {
|
|
28
|
+
return enumeration(KeyType);
|
|
29
|
+
};
|
|
30
|
+
})(KeyType || (KeyType = {}));
|
|
31
|
+
export var PublicKey;
|
|
32
|
+
(function (PublicKey) {
|
|
33
|
+
PublicKey.codec = () => {
|
|
34
|
+
return message({
|
|
35
|
+
1: { name: 'Type', codec: KeyType.codec() },
|
|
36
|
+
2: { name: 'Data', codec: bytes }
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
PublicKey.encode = (obj) => {
|
|
40
|
+
return encodeMessage(obj, PublicKey.codec());
|
|
41
|
+
};
|
|
42
|
+
PublicKey.decode = (buf) => {
|
|
43
|
+
return decodeMessage(buf, PublicKey.codec());
|
|
44
|
+
};
|
|
45
|
+
})(PublicKey || (PublicKey = {}));
|
|
46
|
+
//# sourceMappingURL=proto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proto.js","sourceRoot":"","sources":["../../../../src/insecure/pb/proto.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,oDAAoD;AAEpD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAO3F,MAAM,KAAW,QAAQ,CAexB;AAfD,WAAiB,QAAQ;IACV,cAAK,GAAG,GAAG,EAAE;QACxB,OAAO,OAAO,CAAW;YACvB,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC/C,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;SAChE,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,EAfgB,QAAQ,KAAR,QAAQ,QAexB;AAED,MAAM,CAAN,IAAY,OAKX;AALD,WAAY,OAAO;IACjB,sBAAW,CAAA;IACX,8BAAmB,CAAA;IACnB,kCAAuB,CAAA;IACvB,0BAAe,CAAA;AACjB,CAAC,EALW,OAAO,KAAP,OAAO,QAKlB;AAED,WAAiB,OAAO;IACT,aAAK,GAAG,GAAG,EAAE;QACxB,OAAO,WAAW,CAAiB,OAAO,CAAC,CAAA;IAC7C,CAAC,CAAA;AACH,CAAC,EAJgB,OAAO,KAAP,OAAO,QAIvB;AAOD,MAAM,KAAW,SAAS,CAezB;AAfD,WAAiB,SAAS;IACX,eAAK,GAAG,GAAG,EAAE;QACxB,OAAO,OAAO,CAAY;YACxB,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE;YAC3C,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE;SAClC,CAAC,CAAA;IACJ,CAAC,CAAA;IAEY,gBAAM,GAAG,CAAC,GAAc,EAAc,EAAE;QACnD,OAAO,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC,CAAA;IAC9C,CAAC,CAAA;IAEY,gBAAM,GAAG,CAAC,GAAe,EAAa,EAAE;QACnD,OAAO,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC,CAAA;IAC9C,CAAC,CAAA;AACH,CAAC,EAfgB,SAAS,KAAT,SAAS,QAezB"}
|
|
@@ -52,14 +52,14 @@ export declare class KeyChain {
|
|
|
52
52
|
/**
|
|
53
53
|
* Generates the options for a keychain. A random salt is produced.
|
|
54
54
|
*
|
|
55
|
-
* @returns {
|
|
55
|
+
* @returns {object}
|
|
56
56
|
*/
|
|
57
57
|
static generateOptions(): KeyChainInit;
|
|
58
58
|
/**
|
|
59
59
|
* Gets an object that can encrypt/decrypt protected data.
|
|
60
60
|
* The default options for a keychain.
|
|
61
61
|
*
|
|
62
|
-
* @returns {
|
|
62
|
+
* @returns {object}
|
|
63
63
|
*/
|
|
64
64
|
static get options(): {
|
|
65
65
|
dek: {
|
|
@@ -115,7 +115,7 @@ export class KeyChain {
|
|
|
115
115
|
/**
|
|
116
116
|
* Generates the options for a keychain. A random salt is produced.
|
|
117
117
|
*
|
|
118
|
-
* @returns {
|
|
118
|
+
* @returns {object}
|
|
119
119
|
*/
|
|
120
120
|
static generateOptions() {
|
|
121
121
|
const options = Object.assign({}, defaultOptions);
|
|
@@ -127,7 +127,7 @@ export class KeyChain {
|
|
|
127
127
|
* Gets an object that can encrypt/decrypt protected data.
|
|
128
128
|
* The default options for a keychain.
|
|
129
129
|
*
|
|
130
|
-
* @returns {
|
|
130
|
+
* @returns {object}
|
|
131
131
|
*/
|
|
132
132
|
static get options() {
|
|
133
133
|
return defaultOptions;
|
|
@@ -6,7 +6,7 @@ import 'node-forge/lib/x509.js';
|
|
|
6
6
|
*
|
|
7
7
|
* TODO: move to libp2p-crypto package
|
|
8
8
|
*/
|
|
9
|
-
export declare const certificateForKey: (key: any, privateKey:
|
|
9
|
+
export declare const certificateForKey: (key: any, privateKey: forge.pki.rsa.PrivateKey) => any;
|
|
10
10
|
/**
|
|
11
11
|
* Finds the first item in a collection that is matched in the
|
|
12
12
|
* `asyncCompare` function.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/keychain/util.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAA;AAM/B;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,QAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/keychain/util.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAA;AAM/B;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,QAAS,GAAG,8CAmDzC,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAAE,CAAC,EAAG,KAAK,EAAE,CAAC,EAAE,EAAE,YAAY,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,cAKtF"}
|