You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@libp2p/interface

Package Overview
Dependencies
Maintainers
6
Versions
694
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/interface - npm Package Compare versions

Comparing version

to
2.10.5-cb1c14e62

12

dist/src/connection-encrypter.d.ts
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> {

@@ -114,6 +114,38 @@ /**

export interface Logger {
/**
* Log a message
*/
(formatter: any, ...args: any[]): void;
/**
* Log an error message
*/
error(formatter: any, ...args: any[]): void;
/**
* Log a trace message
*/
trace(formatter: any, ...args: any[]): void;
/**
* `true` if this logger is enabled
*/
enabled: boolean;
/**
* Create a logger scoped below this one
*
* @example
*
* ```ts
* import { defaultLogger } from '@libp2p/logger'
*
* const log = defaultLogger().forComponent('foo')
*
* log('hello')
* // foo hello
*
* const subLog = log.newScope('bar')
*
* subLog('hello')
* // foo:bar hello
* ```
*/
newScope(name: string): Logger;
}

@@ -120,0 +152,0 @@ /**

@@ -17,3 +17,3 @@ import type { Connection, Stream } from './connection.js';

*/
(data: IncomingStreamData): void;
(data: IncomingStreamData): void | Promise<void>;
}

@@ -20,0 +20,0 @@ export interface StreamHandlerOptions extends AbortOptions {

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-87e5d5938",
"version": "2.10.5-cb1c14e62",
"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 @@

@@ -130,6 +130,42 @@ /**

export interface Logger {
/**
* Log a message
*/
(formatter: any, ...args: any[]): void
/**
* Log an error message
*/
error(formatter: any, ...args: any[]): void
/**
* Log a trace message
*/
trace(formatter: any, ...args: any[]): void
/**
* `true` if this logger is enabled
*/
enabled: boolean
/**
* Create a logger scoped below this one
*
* @example
*
* ```ts
* import { defaultLogger } from '@libp2p/logger'
*
* const log = defaultLogger().forComponent('foo')
*
* log('hello')
* // foo hello
*
* const subLog = log.newScope('bar')
*
* subLog('hello')
* // foo:bar hello
* ```
*/
newScope(name: string): Logger
}

@@ -136,0 +172,0 @@

@@ -20,3 +20,3 @@ import type { Connection, Stream } from './connection.js'

*/
(data: IncomingStreamData): void
(data: IncomingStreamData): void | Promise<void>
}

@@ -23,0 +23,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

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