@libp2p/interface
Advanced tools
Comparing version
@@ -617,3 +617,3 @@ /** | ||
*/ | ||
unhandle(protocols: string[] | string): Promise<void>; | ||
unhandle(protocols: string[] | string, options?: AbortOptions): Promise<void>; | ||
/** | ||
@@ -636,3 +636,3 @@ * Register a topology to be informed when peers are encountered that | ||
*/ | ||
register(protocol: string, topology: Topology): Promise<string>; | ||
register(protocol: string, topology: Topology, options?: AbortOptions): Promise<string>; | ||
/** | ||
@@ -639,0 +639,0 @@ * Unregister topology to no longer be informed when peers connect or |
@@ -0,1 +1,2 @@ | ||
import type { AbortOptions } from './index.ts'; | ||
import type { CID } from 'multiformats/cid'; | ||
@@ -39,3 +40,3 @@ import type { MultihashDigest } from 'multiformats/hashes/interface'; | ||
*/ | ||
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean>; | ||
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array, options?: AbortOptions): boolean | Promise<boolean>; | ||
/** | ||
@@ -75,3 +76,3 @@ * Returns this key as a multihash with base58btc encoding | ||
*/ | ||
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean>; | ||
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array, options?: AbortOptions): boolean | Promise<boolean>; | ||
/** | ||
@@ -111,3 +112,3 @@ * Returns this key as a multihash with base58btc encoding | ||
*/ | ||
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean>; | ||
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array, options?: AbortOptions): boolean | Promise<boolean>; | ||
/** | ||
@@ -151,3 +152,3 @@ * Returns this key as a multihash with base58btc encoding | ||
*/ | ||
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean>; | ||
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array, options?: AbortOptions): boolean | Promise<boolean>; | ||
/** | ||
@@ -192,3 +193,3 @@ * Returns this key as a multihash with base58btc encoding | ||
*/ | ||
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array>; | ||
sign(data: Uint8Array | Uint8ArrayList, options?: AbortOptions): Uint8Array | Promise<Uint8Array>; | ||
} | ||
@@ -216,3 +217,3 @@ export interface Ed25519PrivateKey { | ||
*/ | ||
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array>; | ||
sign(data: Uint8Array | Uint8ArrayList, options?: AbortOptions): Uint8Array | Promise<Uint8Array>; | ||
} | ||
@@ -240,3 +241,3 @@ export interface Secp256k1PrivateKey { | ||
*/ | ||
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array>; | ||
sign(data: Uint8Array | Uint8ArrayList, options?: AbortOptions): Uint8Array | Promise<Uint8Array>; | ||
} | ||
@@ -268,3 +269,3 @@ export interface ECDSAPrivateKey { | ||
*/ | ||
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array>; | ||
sign(data: Uint8Array | Uint8ArrayList, options?: AbortOptions): Uint8Array | Promise<Uint8Array>; | ||
} | ||
@@ -271,0 +272,0 @@ export type PrivateKey = RSAPrivateKey | Ed25519PrivateKey | Secp256k1PrivateKey | ECDSAPrivateKey; |
@@ -0,1 +1,2 @@ | ||
import type { AbortOptions } from './index.ts'; | ||
import type { PublicKey } from './keys.js'; | ||
@@ -132,3 +133,3 @@ import type { PeerId } from './peer-id.js'; | ||
*/ | ||
export interface PeerQuery { | ||
export interface PeerQuery extends AbortOptions { | ||
filters?: PeerQueryFilter[]; | ||
@@ -139,2 +140,5 @@ orders?: PeerQueryOrder[]; | ||
} | ||
export interface ConsumePeerRecordOptions extends AbortOptions { | ||
expectedPeer?: PeerId; | ||
} | ||
export interface PeerStore { | ||
@@ -185,3 +189,3 @@ /** | ||
*/ | ||
delete(peerId: PeerId): Promise<void>; | ||
delete(peerId: PeerId, options?: AbortOptions): Promise<void>; | ||
/** | ||
@@ -200,3 +204,3 @@ * Returns true if the passed PeerId is in the peer store | ||
*/ | ||
has(peerId: PeerId): Promise<boolean>; | ||
has(peerId: PeerId, options?: AbortOptions): Promise<boolean>; | ||
/** | ||
@@ -212,3 +216,3 @@ * Returns all data stored for the passed PeerId | ||
*/ | ||
get(peerId: PeerId): Promise<Peer>; | ||
get(peerId: PeerId, options?: AbortOptions): Promise<Peer>; | ||
/** | ||
@@ -238,3 +242,3 @@ * Returns a PeerInfo object for the passed peer id. This is similar to `get` | ||
*/ | ||
getInfo(peerId: PeerId): Promise<PeerInfo>; | ||
getInfo(peerId: PeerId, options?: AbortOptions): Promise<PeerInfo>; | ||
/** | ||
@@ -251,3 +255,3 @@ * Adds a peer to the peer store, overwriting any existing data | ||
*/ | ||
save(id: PeerId, data: PeerData): Promise<Peer>; | ||
save(id: PeerId, data: PeerData, options?: AbortOptions): Promise<Peer>; | ||
/** | ||
@@ -264,3 +268,3 @@ * Adds a peer to the peer store, overwriting only the passed fields | ||
*/ | ||
patch(id: PeerId, data: PeerData): Promise<Peer>; | ||
patch(id: PeerId, data: PeerData, options?: AbortOptions): Promise<Peer>; | ||
/** | ||
@@ -277,3 +281,3 @@ * Adds a peer to the peer store, deeply merging any existing data. | ||
*/ | ||
merge(id: PeerId, data: PeerData): Promise<Peer>; | ||
merge(id: PeerId, data: PeerData, options?: AbortOptions): Promise<Peer>; | ||
/** | ||
@@ -292,4 +296,8 @@ * Unmarshal and verify a signed peer record, extract the multiaddrs and | ||
*/ | ||
consumePeerRecord(buf: Uint8Array, expectedPeer?: PeerId): Promise<boolean>; | ||
consumePeerRecord(buf: Uint8Array, options?: ConsumePeerRecordOptions): Promise<boolean>; | ||
/** | ||
* @deprecated Pass `expectedPeer` as a property of `options` instead | ||
*/ | ||
consumePeerRecord(buf: Uint8Array, expectedPeer?: PeerId, options?: AbortOptions): Promise<boolean>; | ||
} | ||
//# sourceMappingURL=peer-store.d.ts.map |
import type { Connection, Stream } from './connection.js'; | ||
import type { AbortOptions } from './index.ts'; | ||
export interface IncomingStreamData { | ||
@@ -18,3 +19,3 @@ /** | ||
} | ||
export interface StreamHandlerOptions { | ||
export interface StreamHandlerOptions extends AbortOptions { | ||
/** | ||
@@ -21,0 +22,0 @@ * How many incoming streams can be open for this protocol at the same time on each connection |
{ | ||
"name": "@libp2p/interface", | ||
"version": "2.10.2-14dbebea8", | ||
"version": "2.10.2-2a7425cdb", | ||
"description": "The interface implemented by a libp2p node", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0 OR MIT", |
@@ -688,3 +688,3 @@ /** | ||
*/ | ||
unhandle(protocols: string[] | string): Promise<void> | ||
unhandle(protocols: string[] | string, options?: AbortOptions): Promise<void> | ||
@@ -708,3 +708,3 @@ /** | ||
*/ | ||
register(protocol: string, topology: Topology): Promise<string> | ||
register(protocol: string, topology: Topology, options?: AbortOptions): Promise<string> | ||
@@ -711,0 +711,0 @@ /** |
@@ -0,1 +1,2 @@ | ||
import type { AbortOptions } from './index.ts' | ||
import type { CID } from 'multiformats/cid' | ||
@@ -47,3 +48,3 @@ import type { MultihashDigest } from 'multiformats/hashes/interface' | ||
*/ | ||
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean> | ||
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array, options?: AbortOptions): boolean | Promise<boolean> | ||
@@ -90,3 +91,3 @@ /** | ||
*/ | ||
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean> | ||
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array, options?: AbortOptions): boolean | Promise<boolean> | ||
@@ -133,3 +134,3 @@ /** | ||
*/ | ||
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean> | ||
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array, options?: AbortOptions): boolean | Promise<boolean> | ||
@@ -181,3 +182,3 @@ /** | ||
*/ | ||
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array): boolean | Promise<boolean> | ||
verify(data: Uint8Array | Uint8ArrayList, sig: Uint8Array, options?: AbortOptions): boolean | Promise<boolean> | ||
@@ -242,3 +243,3 @@ /** | ||
*/ | ||
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array> | ||
sign(data: Uint8Array | Uint8ArrayList, options?: AbortOptions): Uint8Array | Promise<Uint8Array> | ||
} | ||
@@ -271,3 +272,3 @@ | ||
*/ | ||
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array> | ||
sign(data: Uint8Array | Uint8ArrayList, options?: AbortOptions): Uint8Array | Promise<Uint8Array> | ||
} | ||
@@ -300,3 +301,3 @@ | ||
*/ | ||
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array> | ||
sign(data: Uint8Array | Uint8ArrayList, options?: AbortOptions): Uint8Array | Promise<Uint8Array> | ||
} | ||
@@ -334,3 +335,3 @@ | ||
*/ | ||
sign(data: Uint8Array | Uint8ArrayList): Uint8Array | Promise<Uint8Array> | ||
sign(data: Uint8Array | Uint8ArrayList, options?: AbortOptions): Uint8Array | Promise<Uint8Array> | ||
} | ||
@@ -337,0 +338,0 @@ |
@@ -0,1 +1,2 @@ | ||
import type { AbortOptions } from './index.ts' | ||
import type { PublicKey } from './keys.js' | ||
@@ -150,3 +151,3 @@ import type { PeerId } from './peer-id.js' | ||
*/ | ||
export interface PeerQuery { | ||
export interface PeerQuery extends AbortOptions { | ||
filters?: PeerQueryFilter[] | ||
@@ -158,2 +159,6 @@ orders?: PeerQueryOrder[] | ||
export interface ConsumePeerRecordOptions extends AbortOptions { | ||
expectedPeer?: PeerId | ||
} | ||
export interface PeerStore { | ||
@@ -206,3 +211,3 @@ /** | ||
*/ | ||
delete(peerId: PeerId): Promise<void> | ||
delete(peerId: PeerId, options?: AbortOptions): Promise<void> | ||
@@ -222,3 +227,3 @@ /** | ||
*/ | ||
has(peerId: PeerId): Promise<boolean> | ||
has(peerId: PeerId, options?: AbortOptions): Promise<boolean> | ||
@@ -235,3 +240,3 @@ /** | ||
*/ | ||
get(peerId: PeerId): Promise<Peer> | ||
get(peerId: PeerId, options?: AbortOptions): Promise<Peer> | ||
@@ -262,3 +267,3 @@ /** | ||
*/ | ||
getInfo (peerId: PeerId): Promise<PeerInfo> | ||
getInfo (peerId: PeerId, options?: AbortOptions): Promise<PeerInfo> | ||
@@ -276,3 +281,3 @@ /** | ||
*/ | ||
save(id: PeerId, data: PeerData): Promise<Peer> | ||
save(id: PeerId, data: PeerData, options?: AbortOptions): Promise<Peer> | ||
@@ -290,3 +295,3 @@ /** | ||
*/ | ||
patch(id: PeerId, data: PeerData): Promise<Peer> | ||
patch(id: PeerId, data: PeerData, options?: AbortOptions): Promise<Peer> | ||
@@ -304,3 +309,3 @@ /** | ||
*/ | ||
merge(id: PeerId, data: PeerData): Promise<Peer> | ||
merge(id: PeerId, data: PeerData, options?: AbortOptions): Promise<Peer> | ||
@@ -320,3 +325,8 @@ /** | ||
*/ | ||
consumePeerRecord(buf: Uint8Array, expectedPeer?: PeerId): Promise<boolean> | ||
consumePeerRecord(buf: Uint8Array, options?: ConsumePeerRecordOptions): Promise<boolean> | ||
/** | ||
* @deprecated Pass `expectedPeer` as a property of `options` instead | ||
*/ | ||
consumePeerRecord(buf: Uint8Array, expectedPeer?: PeerId, options?: AbortOptions): Promise<boolean> | ||
} |
import type { Connection, Stream } from './connection.js' | ||
import type { AbortOptions } from './index.ts' | ||
@@ -22,3 +23,3 @@ export interface IncomingStreamData { | ||
export interface StreamHandlerOptions { | ||
export interface StreamHandlerOptions extends AbortOptions { | ||
/** | ||
@@ -25,0 +26,0 @@ * How many incoming streams can be open for this protocol at the same time on each connection |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
437413
0.78%8366
0.24%