Skip to content

Commit

Permalink
feat!: remove default instance (#188)
Browse files Browse the repository at this point in the history
* refactor: remove default instance

* docs: update example to remove default instance usage
  • Loading branch information
Alan Shaw authored Aug 10, 2022
1 parent c2e6b64 commit 1358409
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ Install with `yarn add @chainsafe/libp2p-noise` or `npm i @chainsafe/libp2p-nois
Example of using default noise configuration and passing it to the libp2p config:

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


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

const libp2p = new Libp2p({
modules: {
connEncryption: [NOISE],
connEncryption: [new Noise()],
},
});
```
Expand Down
7 changes: 0 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import { Noise } from './noise.js'

export * from './crypto.js'
export * from './crypto/stablelib.js'
export * from './noise.js'

/**
* Default configuration, it will generate new noise static key and enable noise pipes (IK handshake).
*/
export const NOISE = new Noise()

0 comments on commit 1358409

Please sign in to comment.