@libp2p/interface
Advanced tools
Comparing version
import type { MultiaddrConnection } from './connection.js'; | ||
import type { AbortOptions, StreamMuxerFactory } from './index.js'; | ||
import type { AbortOptions, Logger, StreamMuxerFactory } from './index.js'; | ||
import type { PeerId } from './peer-id.js'; | ||
@@ -22,2 +22,8 @@ import type { Duplex } from 'it-stream-types'; | ||
/** | ||
* A stream with an optional logger | ||
*/ | ||
export interface SecurableStream extends Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>> { | ||
log?: Logger; | ||
} | ||
/** | ||
* A libp2p connection encrypter module must be compliant to this interface | ||
@@ -33,3 +39,3 @@ * to ensure all exchanged data between two peers is encrypted. | ||
*/ | ||
secureOutbound<Stream extends Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>> = MultiaddrConnection>(connection: Stream, options?: SecureConnectionOptions): Promise<SecuredConnection<Stream, Extension>>; | ||
secureOutbound<Stream extends SecurableStream = MultiaddrConnection>(connection: Stream, options?: SecureConnectionOptions): Promise<SecuredConnection<Stream, Extension>>; | ||
/** | ||
@@ -40,3 +46,3 @@ * Decrypt incoming data. If the remote PeerId is known, | ||
*/ | ||
secureInbound<Stream extends Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>> = MultiaddrConnection>(connection: Stream, options?: SecureConnectionOptions): Promise<SecuredConnection<Stream, Extension>>; | ||
secureInbound<Stream extends SecurableStream = MultiaddrConnection>(connection: Stream, options?: SecureConnectionOptions): Promise<SecuredConnection<Stream, Extension>>; | ||
} | ||
@@ -43,0 +49,0 @@ export interface SecuredConnection<Stream = any, Extension = unknown> { |
import type { Direction, Stream } from './connection.js'; | ||
import type { AbortOptions } from './index.js'; | ||
import type { AbortOptions, Logger } from './index.js'; | ||
import type { Duplex } from 'it-stream-types'; | ||
@@ -54,3 +54,7 @@ import type { Uint8ArrayList } from 'uint8arraylist'; | ||
direction?: Direction; | ||
/** | ||
* The logger used by the connection | ||
*/ | ||
log?: Logger; | ||
} | ||
//# sourceMappingURL=stream-muxer.d.ts.map |
{ | ||
"name": "@libp2p/interface", | ||
"version": "2.10.5-58abe8702", | ||
"version": "2.10.5-79473c99a", | ||
"description": "The interface implemented by a libp2p node", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0 OR MIT", |
import type { MultiaddrConnection } from './connection.js' | ||
import type { AbortOptions, StreamMuxerFactory } from './index.js' | ||
import type { AbortOptions, Logger, StreamMuxerFactory } from './index.js' | ||
import type { PeerId } from './peer-id.js' | ||
@@ -25,2 +25,9 @@ import type { Duplex } from 'it-stream-types' | ||
/** | ||
* A stream with an optional logger | ||
*/ | ||
export interface SecurableStream extends Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>> { | ||
log?: Logger | ||
} | ||
/** | ||
* A libp2p connection encrypter module must be compliant to this interface | ||
@@ -37,3 +44,3 @@ * to ensure all exchanged data between two peers is encrypted. | ||
*/ | ||
secureOutbound <Stream extends Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>> = MultiaddrConnection> (connection: Stream, options?: SecureConnectionOptions): Promise<SecuredConnection<Stream, Extension>> | ||
secureOutbound <Stream extends SecurableStream = MultiaddrConnection> (connection: Stream, options?: SecureConnectionOptions): Promise<SecuredConnection<Stream, Extension>> | ||
@@ -45,3 +52,3 @@ /** | ||
*/ | ||
secureInbound <Stream extends Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>> = MultiaddrConnection> (connection: Stream, options?: SecureConnectionOptions): Promise<SecuredConnection<Stream, Extension>> | ||
secureInbound <Stream extends SecurableStream = MultiaddrConnection> (connection: Stream, options?: SecureConnectionOptions): Promise<SecuredConnection<Stream, Extension>> | ||
} | ||
@@ -48,0 +55,0 @@ |
import type { Direction, Stream } from './connection.js' | ||
import type { AbortOptions } from './index.js' | ||
import type { AbortOptions, Logger } from './index.js' | ||
import type { Duplex } from 'it-stream-types' | ||
@@ -63,2 +63,7 @@ import type { Uint8ArrayList } from 'uint8arraylist' | ||
direction?: Direction | ||
/** | ||
* The logger used by the connection | ||
*/ | ||
log?: Logger | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
430352
0.1%8281
0.24%