Fix eslint

This commit is contained in:
morrigan
2019-11-28 17:53:27 +01:00
parent 91af449231
commit 6dc8e8288d
7 changed files with 32 additions and 32 deletions

View File

@ -2,11 +2,11 @@ declare module "it-pb-rpc" {
import { Buffer } from "buffer"; import { Buffer } from "buffer";
import { Duplex } from "it-pair"; import { Duplex } from "it-pair";
type WrappedDuplex = { type WrappedDuplex = {
read(bytes?: number): Promise<Buffer>, read(bytes?: number): Promise<Buffer>;
readLP(): Promise<Buffer>, readLP(): Promise<Buffer>;
write(input: Buffer): void, write(input: Buffer): void;
writeLP(input: Buffer): void, writeLP(input: Buffer): void;
unwrap(): Duplex unwrap(): Duplex;
} }
function Wrap (duplex: any): WrappedDuplex; function Wrap (duplex: any): WrappedDuplex;

View File

@ -2,28 +2,28 @@ import { bytes, bytes32 } from "./basic";
import { Duplex } from "it-pair"; import { Duplex } from "it-pair";
export interface KeyPair { export interface KeyPair {
publicKey: bytes32, publicKey: bytes32;
privateKey: bytes32, privateKey: bytes32;
} }
export type PeerId = { export type PeerId = {
id: bytes, id: bytes;
privKey: { privKey: {
marshal(): bytes, marshal(): bytes;
}, };
pubKey: { pubKey: {
marshal(): bytes, marshal(): bytes;
}, };
}; };
export interface NoiseConnection { export interface NoiseConnection {
remoteEarlyData?(): bytes, remoteEarlyData?(): bytes;
secureOutbound(localPeer: PeerId, insecure: any, remotePeer: PeerId): Promise<SecureOutbound>, secureOutbound(localPeer: PeerId, insecure: any, remotePeer: PeerId): Promise<SecureOutbound>;
secureInbound(localPeer: PeerId, insecure: any, remotePeer: PeerId): Promise<SecureOutbound>, secureInbound(localPeer: PeerId, insecure: any, remotePeer: PeerId): Promise<SecureOutbound>;
} }
export type SecureOutbound = { export type SecureOutbound = {
conn: Duplex, conn: Duplex;
remotePeer: PeerId, remotePeer: PeerId;
} }

View File

@ -2,12 +2,12 @@ import { Duplex } from "it-pair";
import { NoiseSession } from "./xx"; import { NoiseSession } from "./xx";
import { Handshake } from "./handshake"; import { Handshake } from "./handshake";
interface IReturnEncryptionWrapper { interface ReturnEncryptionWrapper {
(source: any): any; (source: any): any;
} }
// Returns generator that encrypts payload from the user // Returns generator that encrypts payload from the user
export function encryptStream(handshake: Handshake, session: NoiseSession) : IReturnEncryptionWrapper { export function encryptStream(handshake: Handshake, session: NoiseSession): ReturnEncryptionWrapper {
return async function * (source) { return async function * (source) {
for await (const chunk of source) { for await (const chunk of source) {
const data = await handshake.encrypt(chunk, session); const data = await handshake.encrypt(chunk, session);
@ -18,7 +18,7 @@ export function encryptStream(handshake: Handshake, session: NoiseSession) : IRe
// Decrypt received payload to the user // Decrypt received payload to the user
export function decryptStream(handshake: Handshake, session: NoiseSession) : IReturnEncryptionWrapper { export function decryptStream(handshake: Handshake, session: NoiseSession): ReturnEncryptionWrapper {
return async function * (source) { return async function * (source) {
for await (const chunk of source) { for await (const chunk of source) {
const decrypted = await handshake.decrypt(chunk, session); const decrypted = await handshake.decrypt(chunk, session);