update docs

This commit is contained in:
Marin Petrunić
2020-02-07 13:06:42 +01:00
parent 2f2476b146
commit 09f98fcc12
4 changed files with 14 additions and 5 deletions

View File

@ -17,9 +17,12 @@ This repository contains TypeScript implementation of noise protocol, an encrypt
When published, package should be imported as: `import { Noise } from 'libp2p-noise'`.
Example of instantiating noise and passing it to the libp2p config:
Example of using default noise configuration and passing it to the libp2p config:
```
const NOISE = new Noise(privateKey);
import {NOISE, Noise} from "@nodefactory/js-libp2p-noise"
//custom noise configuration, pass it instead of NOISE object
const noise = new Noise(privateKey, Buffer.alloc(), false);
const libp2p = new Libp2p({
modules: {

View File

@ -1,6 +1,6 @@
{
"name": "js-libp2p-noise",
"version": "1.0.0",
"version": "1.0.0-beta",
"main": "dist/index.js",
"module": "lib/index.js",
"files": [

View File

@ -1 +1,7 @@
import {Noise} from "./noise";
export * from "./noise";
/**
* Default configuration, it will generate new noise static key and enable noise pipes (IK handshake).
*/
export const NOISE = new Noise();

View File

@ -39,9 +39,9 @@ export class Noise implements INoiseConnection {
/**
*
* @param staticNoiseKey
* @param staticNoiseKey x25519 private key, reuse for faster handshakes
* @param earlyData
* @param useNoisePipes
* @param useNoisePipes enable IK handshake if initiator static key is known
*/
constructor(staticNoiseKey?: bytes, earlyData?: bytes, useNoisePipes = true) {
this.earlyData = earlyData || Buffer.alloc(0);