From 73c336088e4d1052e683974ab2374fcee8ac310b Mon Sep 17 00:00:00 2001 From: Belma Gutlic Date: Tue, 7 Jan 2020 13:09:35 +0100 Subject: [PATCH] Lint fix --- src/handshake-xx-fallback.ts | 4 ++-- src/noise.ts | 2 +- src/utils.ts | 2 +- test/xx-fallback-handshake.test.ts | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/handshake-xx-fallback.ts b/src/handshake-xx-fallback.ts index 17810e3..900705e 100644 --- a/src/handshake-xx-fallback.ts +++ b/src/handshake-xx-fallback.ts @@ -71,7 +71,7 @@ export class Handshake extends XXHandshake { } logger("All good with the signature!"); } else { - logger('Stage 1 - Responder sending out first message with signed payload and static key.'); + logger('XX Fallback Stage 1 - Responder sending out first message with signed payload and static key.'); const signedPayload = signPayload(this.libp2pPrivateKey, getHandshakePayload(this.staticKeys.publicKey)); const signedEarlyDataPayload = signEarlyDataPayload(this.libp2pPrivateKey, Buffer.alloc(0)); const handshakePayload = await createHandshakePayload( @@ -83,7 +83,7 @@ export class Handshake extends XXHandshake { const messageBuffer = this.xx.sendMessage(this.session, handshakePayload); this.connection.writeLP(encode1(messageBuffer)); - logger('Stage 1 - Responder sent the second handshake message with signed payload.') + logger('XX Fallback Stage 1 - Responder sent the second handshake message with signed payload.') } } } diff --git a/src/noise.ts b/src/noise.ts index e0b0b06..81656cf 100644 --- a/src/noise.ts +++ b/src/noise.ts @@ -164,7 +164,7 @@ export class Noise implements NoiseConnection { params: HandshakeParams, ): Promise { const { isInitiator, libp2pPublicKey, remotePeer, connection } = params; - const handshake = new IK(params.isInitiator, this.privateKey, params.libp2pPublicKey, this.prologue, this.staticKeys, params.connection, remotePeer); + const handshake = new IK(isInitiator, this.privateKey, libp2pPublicKey, this.prologue, this.staticKeys, connection, remotePeer); // TODO diff --git a/src/utils.ts b/src/utils.ts index 005f826..ccd6271 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -46,7 +46,7 @@ export async function createHandshakePayload( } -export function signPayload(libp2pPrivateKey: bytes, payload: bytes) { +export function signPayload(libp2pPrivateKey: bytes, payload: bytes): bytes { return ed25519.sign(payload, libp2pPrivateKey); } diff --git a/test/xx-fallback-handshake.test.ts b/test/xx-fallback-handshake.test.ts index 7902e4a..130a8ff 100644 --- a/test/xx-fallback-handshake.test.ts +++ b/test/xx-fallback-handshake.test.ts @@ -6,7 +6,6 @@ import { createHandshakePayload, generateKeypair, getHandshakePayload, - signEarlyDataPayload, signPayload } from "../src/utils"; import {generateEd25519Keys, getKeyPairFromPeerId} from "./utils";