From e66ee7d677ee8122e85194deace1b8f0603d8063 Mon Sep 17 00:00:00 2001 From: Belma Gutlic Date: Tue, 24 Dec 2019 20:45:48 +0100 Subject: [PATCH] Create handshakes dir --- src/encoder.ts | 2 +- src/handshake.ts | 2 +- src/handshakes/ik.ts | 0 src/{ => handshakes}/xx.ts | 6 +++--- test/handshakes/ik.test.ts | 0 test/{ => handshakes}/xx.test.ts | 8 ++++---- test/noise.test.ts | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 src/handshakes/ik.ts rename src/{ => handshakes}/xx.ts (98%) create mode 100644 test/handshakes/ik.test.ts rename test/{ => handshakes}/xx.test.ts (96%) diff --git a/src/encoder.ts b/src/encoder.ts index 6c4cf75..383187b 100644 --- a/src/encoder.ts +++ b/src/encoder.ts @@ -1,6 +1,6 @@ import {Buffer} from "buffer"; import {bytes} from "./@types/basic"; -import {MessageBuffer} from "./xx"; +import {MessageBuffer} from "./handshakes/xx"; export const int16BEEncode = (value, target, offset) => { target = target || Buffer.allocUnsafe(2); diff --git a/src/handshake.ts b/src/handshake.ts index cb76381..d530e05 100644 --- a/src/handshake.ts +++ b/src/handshake.ts @@ -1,7 +1,7 @@ import { Buffer } from "buffer"; import { bytes, bytes32 } from "./@types/basic"; -import { NoiseSession, XXHandshake } from "./xx"; +import { NoiseSession, XXHandshake } from "./handshakes/xx"; import { KeyPair, PeerId } from "./@types/libp2p"; import { createHandshakePayload, diff --git a/src/handshakes/ik.ts b/src/handshakes/ik.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/xx.ts b/src/handshakes/xx.ts similarity index 98% rename from src/xx.ts rename to src/handshakes/xx.ts index d4b479a..7e0c9de 100644 --- a/src/xx.ts +++ b/src/handshakes/xx.ts @@ -2,9 +2,9 @@ import { Buffer } from 'buffer'; import { AEAD, x25519, HKDF, SHA256 } from 'bcrypto'; import { BN } from 'bn.js'; -import { bytes32, uint32, uint64, bytes } from './@types/basic' -import { KeyPair } from './@types/libp2p' -import { generateKeypair } from './utils'; +import { bytes32, uint32, uint64, bytes } from '../@types/basic' +import { KeyPair } from '../@types/libp2p' +import { generateKeypair } from '../utils'; export interface MessageBuffer { ne: bytes32; diff --git a/test/handshakes/ik.test.ts b/test/handshakes/ik.test.ts new file mode 100644 index 0000000..e69de29 diff --git a/test/xx.test.ts b/test/handshakes/xx.test.ts similarity index 96% rename from test/xx.test.ts rename to test/handshakes/xx.test.ts index 1eca6b4..4bc7e1a 100644 --- a/test/xx.test.ts +++ b/test/handshakes/xx.test.ts @@ -1,10 +1,10 @@ import { expect, assert } from "chai"; import { Buffer } from 'buffer'; -import { XXHandshake } from "../src/xx"; -import { KeyPair } from "../src/@types/libp2p"; -import { generateEd25519Keys } from "./utils"; -import {createHandshakePayload, generateKeypair, getHandshakePayload} from "../src/utils"; +import { XXHandshake } from "../../src/handshakes/xx"; +import { KeyPair } from "../../src/@types/libp2p"; +import { generateEd25519Keys } from "../utils"; +import {createHandshakePayload, generateKeypair, getHandshakePayload} from "../../src/utils"; describe("Index", () => { const prologue = Buffer.from("/noise", "utf-8"); diff --git a/test/noise.test.ts b/test/noise.test.ts index 5d68098..5c39494 100644 --- a/test/noise.test.ts +++ b/test/noise.test.ts @@ -12,7 +12,7 @@ import { signPayload } from "../src/utils"; import { decodeMessageBuffer, encodeMessageBuffer } from "../src/encoder"; -import {XXHandshake} from "../src/xx"; +import {XXHandshake} from "../src/handshakes/xx"; import {Buffer} from "buffer"; import {getKeyPairFromPeerId, getRandomBuffer} from "./utils";