mirror of
https://github.com/fluencelabs/js-libp2p-noise
synced 2025-06-27 23:41:41 +00:00
update docs
This commit is contained in:
@ -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: {
|
||||
|
@ -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": [
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user