fix interfaces to be compatible with libp2p-ts

This commit is contained in:
Marin Petrunić 2020-04-03 13:20:15 +02:00
parent 489fcf2b60
commit ba7182685a
No known key found for this signature in database
GPG Key ID: 834D07135E110DA5
3 changed files with 8 additions and 7 deletions

View File

@ -1,6 +1,8 @@
export type Duplex = [Stream, Stream]; declare module 'it-pair' {
export type Duplex = [Stream, Stream];
type Stream = { type Stream = {
sink(source: Iterable<any>); sink(source: Iterable<any>): void;
source: Record<string, any>; source: Record<string, any>;
}
} }

View File

@ -1,5 +1,4 @@
import { bytes, bytes32 } from "./basic"; import { bytes, bytes32 } from "./basic";
import { Duplex } from "it-pair";
import PeerId from "peer-id"; import PeerId from "peer-id";
export type KeyPair = { export type KeyPair = {
@ -14,7 +13,7 @@ export interface INoiseConnection {
} }
export type SecureOutbound = { export type SecureOutbound = {
conn: Duplex; conn: any;
remotePeer: PeerId; remotePeer: PeerId;
} }

View File

@ -14,7 +14,7 @@ import {uint16BEDecode, uint16BEEncode} from "./encoder";
import {decryptStream, encryptStream} from "./crypto"; import {decryptStream, encryptStream} from "./crypto";
import {bytes} from "./@types/basic"; import {bytes} from "./@types/basic";
import {INoiseConnection, KeyPair, SecureOutbound} from "./@types/libp2p"; import {INoiseConnection, KeyPair, SecureOutbound} from "./@types/libp2p";
import {Duplex} from "./@types/it-pair"; import {Duplex} from "it-pair";
import {IHandshake} from "./@types/handshake-interface"; import {IHandshake} from "./@types/handshake-interface";
import {KeyCache} from "./keycache"; import {KeyCache} from "./keycache";
import {logger} from "./logger"; import {logger} from "./logger";