Skip to content

Commit 1358409

Browse files
author
Alan Shaw
authored
feat!: remove default instance (#188)
* refactor: remove default instance * docs: update example to remove default instance usage
1 parent c2e6b64 commit 1358409

2 files changed

Lines changed: 3 additions & 11 deletions

File tree

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,14 @@ Install with `yarn add @chainsafe/libp2p-noise` or `npm i @chainsafe/libp2p-nois
2525
Example of using default noise configuration and passing it to the libp2p config:
2626

2727
```js
28-
import {NOISE, Noise} from "@chainsafe/libp2p-noise"
28+
import {Noise} from "@chainsafe/libp2p-noise"
2929

30-
31-
//custom noise configuration, pass it instead of NOISE instance
30+
//custom noise configuration, pass it instead of `new Noise()`
3231
const noise = new Noise(privateKey, Buffer.alloc(x));
3332

3433
const libp2p = new Libp2p({
3534
modules: {
36-
connEncryption: [NOISE],
35+
connEncryption: [new Noise()],
3736
},
3837
});
3938
```

src/index.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
import { Noise } from './noise.js'
2-
31
export * from './crypto.js'
42
export * from './crypto/stablelib.js'
53
export * from './noise.js'
6-
7-
/**
8-
* Default configuration, it will generate new noise static key and enable noise pipes (IK handshake).
9-
*/
10-
export const NOISE = new Noise()

0 commit comments

Comments
 (0)