Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable noise pipes #41

Merged
merged 2 commits into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {NOISE, Noise} from "libp2p-noise"


//custom noise configuration, pass it instead of NOISE instance
const noise = new Noise(privateKey, Buffer.alloc(), false);
const noise = new Noise(privateKey, Buffer.alloc(x));

const libp2p = new Libp2p({
modules: {
Expand All @@ -35,7 +35,6 @@ const libp2p = new Libp2p({
```

Where parameters for Noise constructor are:
- *private key* - required parameter (32 bytes libp2p peer private key)
- *static Noise key* - (optional) existing private Noise static key
- *early data* - (optional) an early data payload to be sent in handshake messages

Expand Down
6 changes: 3 additions & 3 deletions src/noise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ export class Noise implements INoiseConnection {
*
* @param staticNoiseKey x25519 private key, reuse for faster handshakes
* @param earlyData
* @param useNoisePipes enable IK handshake if initiator static key is known
*/
constructor(staticNoiseKey?: bytes, earlyData?: bytes, useNoisePipes = true) {
constructor(staticNoiseKey?: bytes, earlyData?: bytes) {
this.earlyData = earlyData || Buffer.alloc(0);
this.useNoisePipes = useNoisePipes;
//disabled until properly specked
this.useNoisePipes = false;

if (staticNoiseKey) {
const publicKey = x25519.publicKeyCreate(staticNoiseKey);
Expand Down
8 changes: 4 additions & 4 deletions test/noise.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ describe("Noise", () => {
}
});

it("should communicate through encrypted streams with noise pipes", async() => {
it.skip("should communicate through encrypted streams with noise pipes", async() => {
try {
const staticKeysInitiator = generateKeypair();
const noiseInit = new Noise(staticKeysInitiator.privateKey);
Expand Down Expand Up @@ -172,7 +172,7 @@ describe("Noise", () => {
}
});

it("IK -> XX fallback: initiator has invalid remote static key", async() => {
it.skip("IK -> XX fallback: initiator has invalid remote static key", async() => {
try {
const staticKeysInitiator = generateKeypair();
const noiseInit = new Noise(staticKeysInitiator.privateKey);
Expand Down Expand Up @@ -238,7 +238,7 @@ describe("Noise", () => {
}
});

it("Initiator starts with XX (pipes disabled), responder has enabled noise pipes", async() => {
it.skip("Initiator starts with XX (pipes disabled), responder has enabled noise pipes", async() => {
try {
const staticKeysInitiator = generateKeypair();
const noiseInit = new Noise(staticKeysInitiator.privateKey, undefined, false);
Expand Down Expand Up @@ -273,7 +273,7 @@ describe("Noise", () => {
}
});

it("IK: responder has no remote static key", async() => {
it.skip("IK: responder has no remote static key", async() => {
try {
const staticKeysInitiator = generateKeypair();
const noiseInit = new Noise(staticKeysInitiator.privateKey);
Expand Down