@libp2p/interface 2.10.1 → 2.10.2-2a7425cdb
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/index.min.js.map +2 -2
- package/dist/src/event-target.d.ts +1 -1
- package/dist/src/event-target.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/keys.d.ts +9 -8
- package/dist/src/keys.d.ts.map +1 -1
- package/dist/src/keys.js.map +1 -1
- package/dist/src/peer-store.d.ts +17 -9
- package/dist/src/peer-store.d.ts.map +1 -1
- package/dist/src/peer-store.js.map +1 -1
- package/dist/src/stream-handler.d.ts +2 -1
- package/dist/src/stream-handler.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/event-target.ts +1 -1
- package/src/index.ts +2 -2
- package/src/keys.ts +9 -8
- package/src/peer-store.ts +19 -9
- package/src/stream-handler.ts +2 -1
- package/dist/typedoc-urls.json +0 -223
package/dist/src/keys.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AbortOptions } from './index.ts';
|
|
1
2
|
import type { CID } from 'multiformats/cid';
|
|
2
3
|
import type { MultihashDigest } from 'multiformats/hashes/interface';
|
|
3
4
|
import type { Uint8ArrayList } from 'uint8arraylist';
|
|
@@ -36,7 +37,7 @@ export interface RSAPublicKey {
|
|
|
36
37
|
* Verify the passed data was signed by the private key corresponding to this
|
|
37
38
|
* public key
|
|
38
39
|
*/
|
|
39
|
-
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean>;
|
|
40
|
+
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array, options?: AbortOptions): boolean | Promise<boolean>;
|
|
40
41
|
/**
|
|
41
42
|
* Returns this key as a multihash with base58btc encoding
|
|
42
43
|
*/
|
|
@@ -71,7 +72,7 @@ export interface Ed25519PublicKey {
|
|
|
71
72
|
* Verify the passed data was signed by the private key corresponding to this
|
|
72
73
|
* public key
|
|
73
74
|
*/
|
|
74
|
-
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean>;
|
|
75
|
+
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array, options?: AbortOptions): boolean | Promise<boolean>;
|
|
75
76
|
/**
|
|
76
77
|
* Returns this key as a multihash with base58btc encoding
|
|
77
78
|
*/
|
|
@@ -106,7 +107,7 @@ export interface Secp256k1PublicKey {
|
|
|
106
107
|
* Verify the passed data was signed by the private key corresponding to this
|
|
107
108
|
* public key
|
|
108
109
|
*/
|
|
109
|
-
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean>;
|
|
110
|
+
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array, options?: AbortOptions): boolean | Promise<boolean>;
|
|
110
111
|
/**
|
|
111
112
|
* Returns this key as a multihash with base58btc encoding
|
|
112
113
|
*/
|
|
@@ -145,7 +146,7 @@ export interface ECDSAPublicKey {
|
|
|
145
146
|
* Verify the passed data was signed by the private key corresponding to this
|
|
146
147
|
* public key
|
|
147
148
|
*/
|
|
148
|
-
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean>;
|
|
149
|
+
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array, options?: AbortOptions): boolean | Promise<boolean>;
|
|
149
150
|
/**
|
|
150
151
|
* Returns this key as a multihash with base58btc encoding
|
|
151
152
|
*/
|
|
@@ -185,7 +186,7 @@ export interface RSAPrivateKey {
|
|
|
185
186
|
* Sign the passed data with this private key and return the signature for
|
|
186
187
|
* later verification
|
|
187
188
|
*/
|
|
188
|
-
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array>;
|
|
189
|
+
sign(data: Uint8Array | Uint8ArrayList, options?: AbortOptions): Uint8Array | Promise<Uint8Array>;
|
|
189
190
|
}
|
|
190
191
|
export interface Ed25519PrivateKey {
|
|
191
192
|
/**
|
|
@@ -208,7 +209,7 @@ export interface Ed25519PrivateKey {
|
|
|
208
209
|
* Sign the passed data with this private key and return the signature for
|
|
209
210
|
* later verification
|
|
210
211
|
*/
|
|
211
|
-
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array>;
|
|
212
|
+
sign(data: Uint8Array | Uint8ArrayList, options?: AbortOptions): Uint8Array | Promise<Uint8Array>;
|
|
212
213
|
}
|
|
213
214
|
export interface Secp256k1PrivateKey {
|
|
214
215
|
/**
|
|
@@ -231,7 +232,7 @@ export interface Secp256k1PrivateKey {
|
|
|
231
232
|
* Sign the passed data with this private key and return the signature for
|
|
232
233
|
* later verification
|
|
233
234
|
*/
|
|
234
|
-
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array>;
|
|
235
|
+
sign(data: Uint8Array | Uint8ArrayList, options?: AbortOptions): Uint8Array | Promise<Uint8Array>;
|
|
235
236
|
}
|
|
236
237
|
export interface ECDSAPrivateKey {
|
|
237
238
|
/**
|
|
@@ -258,7 +259,7 @@ export interface ECDSAPrivateKey {
|
|
|
258
259
|
* Sign the passed data with this private key and return the signature for
|
|
259
260
|
* later verification
|
|
260
261
|
*/
|
|
261
|
-
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array>;
|
|
262
|
+
sign(data: Uint8Array | Uint8ArrayList, options?: AbortOptions): Uint8Array | Promise<Uint8Array>;
|
|
262
263
|
}
|
|
263
264
|
export type PrivateKey = RSAPrivateKey | Ed25519PrivateKey | Secp256k1PrivateKey | ECDSAPrivateKey;
|
|
264
265
|
/**
|
package/dist/src/keys.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE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EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;CAClG;AAED,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IAEtB;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAA;IAElC;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAA;IAExB;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAA;IAExB;;OAEG;IACH,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAA;IAE1B;;;OAGG;IACH,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;CAClG;AAED,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,eAAe,CAAA;AAElG;;;GAGG;AACH,wBAAgB,YAAY,CAAE,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,IAAI,UAAU,CAU1D"}
|
package/dist/src/keys.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/keys.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/keys.ts"],"names":[],"mappings":"AA4LA;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAE,GAAS;IACpC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAChB,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC;QACvG,GAAG,CAAC,GAAG,YAAY,UAAU;QAC7B,OAAO,GAAG,CAAC,MAAM,KAAK,UAAU;QAChC,OAAO,GAAG,CAAC,WAAW,KAAK,UAAU;QACrC,OAAO,GAAG,CAAC,KAAK,KAAK,UAAU;QAC/B,OAAO,GAAG,CAAC,MAAM,KAAK,UAAU,CAAA;AACpC,CAAC;AAiID;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAE,GAAS;IACrC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAChB,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC;QACvG,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC;QAC1B,GAAG,CAAC,GAAG,YAAY,UAAU;QAC7B,OAAO,GAAG,CAAC,MAAM,KAAK,UAAU;QAChC,OAAO,GAAG,CAAC,IAAI,KAAK,UAAU,CAAA;AAClC,CAAC"}
|
package/dist/src/peer-store.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AbortOptions } from './index.ts';
|
|
1
2
|
import type { PublicKey } from './keys.js';
|
|
2
3
|
import type { PeerId } from './peer-id.js';
|
|
3
4
|
import type { PeerInfo } from './peer-info.js';
|
|
@@ -129,12 +130,15 @@ export interface PeerQueryOrder {
|
|
|
129
130
|
/**
|
|
130
131
|
* A query for getting lists of peers
|
|
131
132
|
*/
|
|
132
|
-
export interface PeerQuery {
|
|
133
|
+
export interface PeerQuery extends AbortOptions {
|
|
133
134
|
filters?: PeerQueryFilter[];
|
|
134
135
|
orders?: PeerQueryOrder[];
|
|
135
136
|
limit?: number;
|
|
136
137
|
offset?: number;
|
|
137
138
|
}
|
|
139
|
+
export interface ConsumePeerRecordOptions extends AbortOptions {
|
|
140
|
+
expectedPeer?: PeerId;
|
|
141
|
+
}
|
|
138
142
|
export interface PeerStore {
|
|
139
143
|
/**
|
|
140
144
|
* Loop over every peer - the looping is async because we read from a
|
|
@@ -180,7 +184,7 @@ export interface PeerStore {
|
|
|
180
184
|
* // []
|
|
181
185
|
* ```
|
|
182
186
|
*/
|
|
183
|
-
delete(peerId: PeerId): Promise<void>;
|
|
187
|
+
delete(peerId: PeerId, options?: AbortOptions): Promise<void>;
|
|
184
188
|
/**
|
|
185
189
|
* Returns true if the passed PeerId is in the peer store
|
|
186
190
|
*
|
|
@@ -194,7 +198,7 @@ export interface PeerStore {
|
|
|
194
198
|
* // true
|
|
195
199
|
* ```
|
|
196
200
|
*/
|
|
197
|
-
has(peerId: PeerId): Promise<boolean>;
|
|
201
|
+
has(peerId: PeerId, options?: AbortOptions): Promise<boolean>;
|
|
198
202
|
/**
|
|
199
203
|
* Returns all data stored for the passed PeerId
|
|
200
204
|
*
|
|
@@ -205,7 +209,7 @@ export interface PeerStore {
|
|
|
205
209
|
* // { .. }
|
|
206
210
|
* ```
|
|
207
211
|
*/
|
|
208
|
-
get(peerId: PeerId): Promise<Peer>;
|
|
212
|
+
get(peerId: PeerId, options?: AbortOptions): Promise<Peer>;
|
|
209
213
|
/**
|
|
210
214
|
* Returns a PeerInfo object for the passed peer id. This is similar to `get`
|
|
211
215
|
* except the returned value contains fewer fields and is often used to
|
|
@@ -230,7 +234,7 @@ export interface PeerStore {
|
|
|
230
234
|
* // }
|
|
231
235
|
* ```
|
|
232
236
|
*/
|
|
233
|
-
getInfo(peerId: PeerId): Promise<PeerInfo>;
|
|
237
|
+
getInfo(peerId: PeerId, options?: AbortOptions): Promise<PeerInfo>;
|
|
234
238
|
/**
|
|
235
239
|
* Adds a peer to the peer store, overwriting any existing data
|
|
236
240
|
*
|
|
@@ -242,7 +246,7 @@ export interface PeerStore {
|
|
|
242
246
|
* })
|
|
243
247
|
* ```
|
|
244
248
|
*/
|
|
245
|
-
save(id: PeerId, data: PeerData): Promise<Peer>;
|
|
249
|
+
save(id: PeerId, data: PeerData, options?: AbortOptions): Promise<Peer>;
|
|
246
250
|
/**
|
|
247
251
|
* Adds a peer to the peer store, overwriting only the passed fields
|
|
248
252
|
*
|
|
@@ -254,7 +258,7 @@ export interface PeerStore {
|
|
|
254
258
|
* })
|
|
255
259
|
* ```
|
|
256
260
|
*/
|
|
257
|
-
patch(id: PeerId, data: PeerData): Promise<Peer>;
|
|
261
|
+
patch(id: PeerId, data: PeerData, options?: AbortOptions): Promise<Peer>;
|
|
258
262
|
/**
|
|
259
263
|
* Adds a peer to the peer store, deeply merging any existing data.
|
|
260
264
|
*
|
|
@@ -266,7 +270,7 @@ export interface PeerStore {
|
|
|
266
270
|
* })
|
|
267
271
|
* ```
|
|
268
272
|
*/
|
|
269
|
-
merge(id: PeerId, data: PeerData): Promise<Peer>;
|
|
273
|
+
merge(id: PeerId, data: PeerData, options?: AbortOptions): Promise<Peer>;
|
|
270
274
|
/**
|
|
271
275
|
* Unmarshal and verify a signed peer record, extract the multiaddrs and
|
|
272
276
|
* overwrite the stored addresses for the peer.
|
|
@@ -280,6 +284,10 @@ export interface PeerStore {
|
|
|
280
284
|
* await peerStore.consumePeerRecord(buf, expectedPeer)
|
|
281
285
|
* ```
|
|
282
286
|
*/
|
|
283
|
-
consumePeerRecord(buf: Uint8Array,
|
|
287
|
+
consumePeerRecord(buf: Uint8Array, options?: ConsumePeerRecordOptions): Promise<boolean>;
|
|
288
|
+
/**
|
|
289
|
+
* @deprecated Pass `expectedPeer` as a property of `options` instead
|
|
290
|
+
*/
|
|
291
|
+
consumePeerRecord(buf: Uint8Array, expectedPeer?: PeerId, options?: AbortOptions): Promise<boolean>;
|
|
284
292
|
}
|
|
285
293
|
//# sourceMappingURL=peer-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer-store.d.ts","sourceRoot":"","sources":["../../src/peer-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC1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AAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEvE;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAExE;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAExE;;;;;;;;;;;;OAYG;IACH,iBAAiB,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAExF;;OAEG;IACH,iBAAiB,CAAC,GAAG,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACpG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer-store.js","sourceRoot":"","sources":["../../src/peer-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"peer-store.js","sourceRoot":"","sources":["../../src/peer-store.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Connection, Stream } from './connection.js';
|
|
2
|
+
import type { AbortOptions } from './index.ts';
|
|
2
3
|
export interface IncomingStreamData {
|
|
3
4
|
/**
|
|
4
5
|
* The newly opened stream
|
|
@@ -15,7 +16,7 @@ export interface StreamHandler {
|
|
|
15
16
|
*/
|
|
16
17
|
(data: IncomingStreamData): void;
|
|
17
18
|
}
|
|
18
|
-
export interface StreamHandlerOptions {
|
|
19
|
+
export interface StreamHandlerOptions extends AbortOptions {
|
|
19
20
|
/**
|
|
20
21
|
* How many incoming streams can be open for this protocol at the same time on each connection
|
|
21
22
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-handler.d.ts","sourceRoot":"","sources":["../../src/stream-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"stream-handler.d.ts","sourceRoot":"","sources":["../../src/stream-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,UAAU,EAAE,UAAU,CAAA;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAAA;CACjC;AAED,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAE1B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAE3B;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAEhC;;;OAGG;IACH,KAAK,CAAC,EAAE,IAAI,CAAA;CACb;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,OAAO,EAAE,aAAa,CAAA;IAEtB;;OAEG;IACH,OAAO,EAAE,oBAAoB,CAAA;CAC9B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/interface",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.2-2a7425cdb",
|
|
4
4
|
"description": "The interface implemented by a libp2p node",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/interface#readme",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"@multiformats/multiaddr": "^12.4.0",
|
|
45
45
|
"it-pushable": "^3.2.3",
|
|
46
46
|
"it-stream-types": "^2.0.2",
|
|
47
|
-
"multiformats": "^13.3.
|
|
47
|
+
"multiformats": "^13.3.6",
|
|
48
48
|
"progress-events": "^1.0.1",
|
|
49
49
|
"uint8arraylist": "^2.4.8"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"aegir": "^47.0.
|
|
52
|
+
"aegir": "^47.0.14"
|
|
53
53
|
},
|
|
54
54
|
"browser": {
|
|
55
55
|
"./dist/src/events.js": "./dist/src/events.browser.js"
|
package/src/event-target.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface TypedEventTarget <EventMap extends Record<string, any>> extends
|
|
|
27
27
|
|
|
28
28
|
removeEventListener (type: string, listener?: EventHandler<Event>, options?: boolean | EventListenerOptions): void
|
|
29
29
|
|
|
30
|
-
safeDispatchEvent<Detail>(type: keyof EventMap, detail
|
|
30
|
+
safeDispatchEvent<Detail>(type: keyof EventMap, detail?: CustomEventInit<Detail>): boolean
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
package/src/index.ts
CHANGED
|
@@ -685,7 +685,7 @@ export interface Libp2p<T extends ServiceMap = ServiceMap> extends Startable, Ty
|
|
|
685
685
|
* libp2p.unhandle(['/echo/1.0.0'])
|
|
686
686
|
* ```
|
|
687
687
|
*/
|
|
688
|
-
unhandle(protocols: string[] | string): Promise<void>
|
|
688
|
+
unhandle(protocols: string[] | string, options?: AbortOptions): Promise<void>
|
|
689
689
|
|
|
690
690
|
/**
|
|
691
691
|
* Register a topology to be informed when peers are encountered that
|
|
@@ -704,7 +704,7 @@ export interface Libp2p<T extends ServiceMap = ServiceMap> extends Startable, Ty
|
|
|
704
704
|
* })
|
|
705
705
|
* ```
|
|
706
706
|
*/
|
|
707
|
-
register(protocol: string, topology: Topology): Promise<string>
|
|
707
|
+
register(protocol: string, topology: Topology, options?: AbortOptions): Promise<string>
|
|
708
708
|
|
|
709
709
|
/**
|
|
710
710
|
* Unregister topology to no longer be informed when peers connect or
|
package/src/keys.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AbortOptions } from './index.ts'
|
|
1
2
|
import type { CID } from 'multiformats/cid'
|
|
2
3
|
import type { MultihashDigest } from 'multiformats/hashes/interface'
|
|
3
4
|
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
@@ -44,7 +45,7 @@ export interface RSAPublicKey {
|
|
|
44
45
|
* Verify the passed data was signed by the private key corresponding to this
|
|
45
46
|
* public key
|
|
46
47
|
*/
|
|
47
|
-
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean>
|
|
48
|
+
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array, options?: AbortOptions): boolean | Promise<boolean>
|
|
48
49
|
|
|
49
50
|
/**
|
|
50
51
|
* Returns this key as a multihash with base58btc encoding
|
|
@@ -86,7 +87,7 @@ export interface Ed25519PublicKey {
|
|
|
86
87
|
* Verify the passed data was signed by the private key corresponding to this
|
|
87
88
|
* public key
|
|
88
89
|
*/
|
|
89
|
-
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean>
|
|
90
|
+
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array, options?: AbortOptions): boolean | Promise<boolean>
|
|
90
91
|
|
|
91
92
|
/**
|
|
92
93
|
* Returns this key as a multihash with base58btc encoding
|
|
@@ -128,7 +129,7 @@ export interface Secp256k1PublicKey {
|
|
|
128
129
|
* Verify the passed data was signed by the private key corresponding to this
|
|
129
130
|
* public key
|
|
130
131
|
*/
|
|
131
|
-
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean>
|
|
132
|
+
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array, options?: AbortOptions): boolean | Promise<boolean>
|
|
132
133
|
|
|
133
134
|
/**
|
|
134
135
|
* Returns this key as a multihash with base58btc encoding
|
|
@@ -175,7 +176,7 @@ export interface ECDSAPublicKey {
|
|
|
175
176
|
* Verify the passed data was signed by the private key corresponding to this
|
|
176
177
|
* public key
|
|
177
178
|
*/
|
|
178
|
-
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean>
|
|
179
|
+
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array, options?: AbortOptions): boolean | Promise<boolean>
|
|
179
180
|
|
|
180
181
|
/**
|
|
181
182
|
* Returns this key as a multihash with base58btc encoding
|
|
@@ -235,7 +236,7 @@ export interface RSAPrivateKey {
|
|
|
235
236
|
* Sign the passed data with this private key and return the signature for
|
|
236
237
|
* later verification
|
|
237
238
|
*/
|
|
238
|
-
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array>
|
|
239
|
+
sign(data: Uint8Array | Uint8ArrayList, options?: AbortOptions): Uint8Array | Promise<Uint8Array>
|
|
239
240
|
}
|
|
240
241
|
|
|
241
242
|
export interface Ed25519PrivateKey {
|
|
@@ -263,7 +264,7 @@ export interface Ed25519PrivateKey {
|
|
|
263
264
|
* Sign the passed data with this private key and return the signature for
|
|
264
265
|
* later verification
|
|
265
266
|
*/
|
|
266
|
-
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array>
|
|
267
|
+
sign(data: Uint8Array | Uint8ArrayList, options?: AbortOptions): Uint8Array | Promise<Uint8Array>
|
|
267
268
|
}
|
|
268
269
|
|
|
269
270
|
export interface Secp256k1PrivateKey {
|
|
@@ -291,7 +292,7 @@ export interface Secp256k1PrivateKey {
|
|
|
291
292
|
* Sign the passed data with this private key and return the signature for
|
|
292
293
|
* later verification
|
|
293
294
|
*/
|
|
294
|
-
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array>
|
|
295
|
+
sign(data: Uint8Array | Uint8ArrayList, options?: AbortOptions): Uint8Array | Promise<Uint8Array>
|
|
295
296
|
}
|
|
296
297
|
|
|
297
298
|
export interface ECDSAPrivateKey {
|
|
@@ -324,7 +325,7 @@ export interface ECDSAPrivateKey {
|
|
|
324
325
|
* Sign the passed data with this private key and return the signature for
|
|
325
326
|
* later verification
|
|
326
327
|
*/
|
|
327
|
-
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array>
|
|
328
|
+
sign(data: Uint8Array | Uint8ArrayList, options?: AbortOptions): Uint8Array | Promise<Uint8Array>
|
|
328
329
|
}
|
|
329
330
|
|
|
330
331
|
export type PrivateKey = RSAPrivateKey | Ed25519PrivateKey | Secp256k1PrivateKey | ECDSAPrivateKey
|
package/src/peer-store.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AbortOptions } from './index.ts'
|
|
1
2
|
import type { PublicKey } from './keys.js'
|
|
2
3
|
import type { PeerId } from './peer-id.js'
|
|
3
4
|
import type { PeerInfo } from './peer-info.js'
|
|
@@ -147,13 +148,17 @@ export interface PeerQueryOrder { (a: Peer, b: Peer): -1 | 0 | 1 }
|
|
|
147
148
|
/**
|
|
148
149
|
* A query for getting lists of peers
|
|
149
150
|
*/
|
|
150
|
-
export interface PeerQuery {
|
|
151
|
+
export interface PeerQuery extends AbortOptions {
|
|
151
152
|
filters?: PeerQueryFilter[]
|
|
152
153
|
orders?: PeerQueryOrder[]
|
|
153
154
|
limit?: number
|
|
154
155
|
offset?: number
|
|
155
156
|
}
|
|
156
157
|
|
|
158
|
+
export interface ConsumePeerRecordOptions extends AbortOptions {
|
|
159
|
+
expectedPeer?: PeerId
|
|
160
|
+
}
|
|
161
|
+
|
|
157
162
|
export interface PeerStore {
|
|
158
163
|
/**
|
|
159
164
|
* Loop over every peer - the looping is async because we read from a
|
|
@@ -201,7 +206,7 @@ export interface PeerStore {
|
|
|
201
206
|
* // []
|
|
202
207
|
* ```
|
|
203
208
|
*/
|
|
204
|
-
delete(peerId: PeerId): Promise<void>
|
|
209
|
+
delete(peerId: PeerId, options?: AbortOptions): Promise<void>
|
|
205
210
|
|
|
206
211
|
/**
|
|
207
212
|
* Returns true if the passed PeerId is in the peer store
|
|
@@ -216,7 +221,7 @@ export interface PeerStore {
|
|
|
216
221
|
* // true
|
|
217
222
|
* ```
|
|
218
223
|
*/
|
|
219
|
-
has(peerId: PeerId): Promise<boolean>
|
|
224
|
+
has(peerId: PeerId, options?: AbortOptions): Promise<boolean>
|
|
220
225
|
|
|
221
226
|
/**
|
|
222
227
|
* Returns all data stored for the passed PeerId
|
|
@@ -228,7 +233,7 @@ export interface PeerStore {
|
|
|
228
233
|
* // { .. }
|
|
229
234
|
* ```
|
|
230
235
|
*/
|
|
231
|
-
get(peerId: PeerId): Promise<Peer>
|
|
236
|
+
get(peerId: PeerId, options?: AbortOptions): Promise<Peer>
|
|
232
237
|
|
|
233
238
|
/**
|
|
234
239
|
* Returns a PeerInfo object for the passed peer id. This is similar to `get`
|
|
@@ -254,7 +259,7 @@ export interface PeerStore {
|
|
|
254
259
|
* // }
|
|
255
260
|
* ```
|
|
256
261
|
*/
|
|
257
|
-
getInfo (peerId: PeerId): Promise<PeerInfo>
|
|
262
|
+
getInfo (peerId: PeerId, options?: AbortOptions): Promise<PeerInfo>
|
|
258
263
|
|
|
259
264
|
/**
|
|
260
265
|
* Adds a peer to the peer store, overwriting any existing data
|
|
@@ -267,7 +272,7 @@ export interface PeerStore {
|
|
|
267
272
|
* })
|
|
268
273
|
* ```
|
|
269
274
|
*/
|
|
270
|
-
save(id: PeerId, data: PeerData): Promise<Peer>
|
|
275
|
+
save(id: PeerId, data: PeerData, options?: AbortOptions): Promise<Peer>
|
|
271
276
|
|
|
272
277
|
/**
|
|
273
278
|
* Adds a peer to the peer store, overwriting only the passed fields
|
|
@@ -280,7 +285,7 @@ export interface PeerStore {
|
|
|
280
285
|
* })
|
|
281
286
|
* ```
|
|
282
287
|
*/
|
|
283
|
-
patch(id: PeerId, data: PeerData): Promise<Peer>
|
|
288
|
+
patch(id: PeerId, data: PeerData, options?: AbortOptions): Promise<Peer>
|
|
284
289
|
|
|
285
290
|
/**
|
|
286
291
|
* Adds a peer to the peer store, deeply merging any existing data.
|
|
@@ -293,7 +298,7 @@ export interface PeerStore {
|
|
|
293
298
|
* })
|
|
294
299
|
* ```
|
|
295
300
|
*/
|
|
296
|
-
merge(id: PeerId, data: PeerData): Promise<Peer>
|
|
301
|
+
merge(id: PeerId, data: PeerData, options?: AbortOptions): Promise<Peer>
|
|
297
302
|
|
|
298
303
|
/**
|
|
299
304
|
* Unmarshal and verify a signed peer record, extract the multiaddrs and
|
|
@@ -308,5 +313,10 @@ export interface PeerStore {
|
|
|
308
313
|
* await peerStore.consumePeerRecord(buf, expectedPeer)
|
|
309
314
|
* ```
|
|
310
315
|
*/
|
|
311
|
-
consumePeerRecord(buf: Uint8Array,
|
|
316
|
+
consumePeerRecord(buf: Uint8Array, options?: ConsumePeerRecordOptions): Promise<boolean>
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* @deprecated Pass `expectedPeer` as a property of `options` instead
|
|
320
|
+
*/
|
|
321
|
+
consumePeerRecord(buf: Uint8Array, expectedPeer?: PeerId, options?: AbortOptions): Promise<boolean>
|
|
312
322
|
}
|
package/src/stream-handler.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Connection, Stream } from './connection.js'
|
|
2
|
+
import type { AbortOptions } from './index.ts'
|
|
2
3
|
|
|
3
4
|
export interface IncomingStreamData {
|
|
4
5
|
/**
|
|
@@ -19,7 +20,7 @@ export interface StreamHandler {
|
|
|
19
20
|
(data: IncomingStreamData): void
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
export interface StreamHandlerOptions {
|
|
23
|
+
export interface StreamHandlerOptions extends AbortOptions {
|
|
23
24
|
/**
|
|
24
25
|
* How many incoming streams can be open for this protocol at the same time on each connection
|
|
25
26
|
*
|