mirror of
https://github.com/fluencelabs/libp2p-ts
synced 2025-04-25 13:42:15 +00:00
fix connection encryption and secio interface
This commit is contained in:
parent
f69df443d3
commit
3b20692fb2
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@chainsafe/libp2p-ts",
|
"name": "libp2p-ts",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "Typescript definitions that are not (yet) available on https://github.com/DefinitelyTyped/DefinitelyTyped",
|
"description": "Typescript definitions that are not (yet) available on https://github.com/DefinitelyTyped/DefinitelyTyped",
|
||||||
"repository": "https://github.com/chainsafe/libp2p-ts.git",
|
"repository": "https://github.com/chainsafe/libp2p-ts.git",
|
||||||
|
4
types/libp2p-secio/index.d.ts
vendored
4
types/libp2p-secio/index.d.ts
vendored
@ -5,9 +5,7 @@
|
|||||||
|
|
||||||
/// <reference types="libp2p"/>
|
/// <reference types="libp2p"/>
|
||||||
|
|
||||||
import {ConnectionEncryption} from "../libp2p";
|
declare type LibP2pSecio = LibP2p.ConnectionEncryption;
|
||||||
|
|
||||||
declare type LibP2pSecio = ConnectionEncryption;
|
|
||||||
|
|
||||||
declare module 'libp2p-secio' {
|
declare module 'libp2p-secio' {
|
||||||
const secio: LibP2pSecio;
|
const secio: LibP2pSecio;
|
||||||
|
26
types/libp2p/index.d.ts
vendored
26
types/libp2p/index.d.ts
vendored
@ -9,14 +9,12 @@
|
|||||||
/// <reference types="libp2p-kad-dht"/>
|
/// <reference types="libp2p-kad-dht"/>
|
||||||
/// <reference types="libp2p-mdns"/>
|
/// <reference types="libp2p-mdns"/>
|
||||||
/// <reference types="libp2p-mplex"/>
|
/// <reference types="libp2p-mplex"/>
|
||||||
/// <reference types="libp2p-secio"/>
|
|
||||||
/// <reference types="libp2p-spdy"/>
|
/// <reference types="libp2p-spdy"/>
|
||||||
/// <reference types="peer-info"/>
|
/// <reference types="peer-info"/>
|
||||||
/// <reference types="peer-id"/>
|
/// <reference types="peer-id"/>
|
||||||
|
|
||||||
import * as PeerId from "peer-id";
|
|
||||||
|
|
||||||
declare namespace LibP2p {
|
declare namespace LibP2p {
|
||||||
|
|
||||||
export type OptionsConfig = {
|
export type OptionsConfig = {
|
||||||
contentRouting?: {},
|
contentRouting?: {},
|
||||||
dht?: {
|
dht?: {
|
||||||
@ -76,6 +74,17 @@ declare namespace LibP2p {
|
|||||||
peerInfo: PeerInfo,
|
peerInfo: PeerInfo,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export interface ConnectionEncryption {
|
||||||
|
protocol: string,
|
||||||
|
secureInbound(localPeer: import("peer-id"), connection: LibP2pConnection, remotePeer: import("peer-id")): Promise<SecureConnection>;
|
||||||
|
secureOutbound(localPeer: import("peer-id"), connection: LibP2pConnection, remotePeer?: import("peer-id")): Promise<SecureConnection>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SecureConnection {
|
||||||
|
conn: LibP2pConnection,
|
||||||
|
remotePeer: import("peer-id")
|
||||||
|
}
|
||||||
|
|
||||||
export type Events = 'peer:connect' | 'peer:disconnect' | 'peer:discovery' | 'start' | 'stop';
|
export type Events = 'peer:connect' | 'peer:disconnect' | 'peer:discovery' | 'start' | 'stop';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,17 +92,6 @@ declare class PeerStore {
|
|||||||
readonly peers: Map<string, PeerInfo>;
|
readonly peers: Map<string, PeerInfo>;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare interface ConnectionEncryption {
|
|
||||||
protocol: string,
|
|
||||||
secureInbound(localPeer: PeerId, connection: LibP2pConnection, remotePeer: PeerId): Promise<SecureConnection>;
|
|
||||||
secureOutbound(localPeer: PeerId, connection: LibP2pConnection, remotePeer?: PeerId): Promise<SecureConnection>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare interface SecureConnection {
|
|
||||||
conn: LibP2pConnection,
|
|
||||||
remotePeer: PeerId
|
|
||||||
}
|
|
||||||
|
|
||||||
declare class Registrar {
|
declare class Registrar {
|
||||||
getConnection(peerInfo: PeerInfo): LibP2pConnection;
|
getConnection(peerInfo: PeerInfo): LibP2pConnection;
|
||||||
handle: Function;
|
handle: Function;
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
"typeRoots": ["../"],
|
"typeRoots": ["../"],
|
||||||
"types": [],
|
"types": [],
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"forceConsistentCasingInFileNames": true
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"allowSyntheticDefaultImports": true
|
||||||
},
|
},
|
||||||
"files": ["index.d.ts", "libp2p-tests.ts"]
|
"files": ["index.d.ts", "libp2p-tests.ts"]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user