mirror of
https://github.com/fluencelabs/js-libp2p-noise
synced 2025-04-25 18:32:22 +00:00
Merge pull request #41 from NodeFactoryIo/mpetrunic/disable-noise-pipes
Disable noise pipes
This commit is contained in:
commit
c1151213b4
@ -25,7 +25,7 @@ import {NOISE, Noise} from "libp2p-noise"
|
|||||||
|
|
||||||
|
|
||||||
//custom noise configuration, pass it instead of NOISE instance
|
//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({
|
const libp2p = new Libp2p({
|
||||||
modules: {
|
modules: {
|
||||||
@ -35,7 +35,6 @@ const libp2p = new Libp2p({
|
|||||||
```
|
```
|
||||||
|
|
||||||
Where parameters for Noise constructor are:
|
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
|
- *static Noise key* - (optional) existing private Noise static key
|
||||||
- *early data* - (optional) an early data payload to be sent in handshake messages
|
- *early data* - (optional) an early data payload to be sent in handshake messages
|
||||||
|
|
||||||
|
@ -42,11 +42,11 @@ export class Noise implements INoiseConnection {
|
|||||||
*
|
*
|
||||||
* @param staticNoiseKey x25519 private key, reuse for faster handshakes
|
* @param staticNoiseKey x25519 private key, reuse for faster handshakes
|
||||||
* @param earlyData
|
* @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.earlyData = earlyData || Buffer.alloc(0);
|
||||||
this.useNoisePipes = useNoisePipes;
|
//disabled until properly specked
|
||||||
|
this.useNoisePipes = false;
|
||||||
|
|
||||||
if (staticNoiseKey) {
|
if (staticNoiseKey) {
|
||||||
const publicKey = x25519.publicKeyCreate(staticNoiseKey);
|
const publicKey = x25519.publicKeyCreate(staticNoiseKey);
|
||||||
|
@ -133,7 +133,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 {
|
try {
|
||||||
const staticKeysInitiator = generateKeypair();
|
const staticKeysInitiator = generateKeypair();
|
||||||
const noiseInit = new Noise(staticKeysInitiator.privateKey);
|
const noiseInit = new Noise(staticKeysInitiator.privateKey);
|
||||||
@ -167,7 +167,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 {
|
try {
|
||||||
const staticKeysInitiator = generateKeypair();
|
const staticKeysInitiator = generateKeypair();
|
||||||
const noiseInit = new Noise(staticKeysInitiator.privateKey);
|
const noiseInit = new Noise(staticKeysInitiator.privateKey);
|
||||||
@ -233,7 +233,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 {
|
try {
|
||||||
const staticKeysInitiator = generateKeypair();
|
const staticKeysInitiator = generateKeypair();
|
||||||
const noiseInit = new Noise(staticKeysInitiator.privateKey, undefined, false);
|
const noiseInit = new Noise(staticKeysInitiator.privateKey, undefined, false);
|
||||||
@ -268,7 +268,7 @@ describe("Noise", () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it("IK: responder has no remote static key", async() => {
|
it.skip("IK: responder has no remote static key", async() => {
|
||||||
try {
|
try {
|
||||||
const staticKeysInitiator = generateKeypair();
|
const staticKeysInitiator = generateKeypair();
|
||||||
const noiseInit = new Noise(staticKeysInitiator.privateKey);
|
const noiseInit = new Noise(staticKeysInitiator.privateKey);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user