@libp2p/noise 12.0.1 → 16.1.4-0f07e3df5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -0
- package/dist/index.min.js +16 -20
- package/dist/index.min.js.map +7 -0
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +1 -0
- package/dist/src/constants.js.map +1 -1
- package/dist/src/crypto/index.browser.d.ts +2 -0
- package/dist/src/crypto/index.browser.d.ts.map +1 -0
- package/dist/src/crypto/index.browser.js +3 -0
- package/dist/src/crypto/index.browser.js.map +1 -0
- package/dist/src/crypto/index.d.ts +3 -0
- package/dist/src/crypto/index.d.ts.map +1 -0
- package/dist/src/crypto/index.js +188 -0
- package/dist/src/crypto/index.js.map +1 -0
- package/dist/src/crypto/js.d.ts.map +1 -1
- package/dist/src/crypto/js.js +18 -17
- package/dist/src/crypto/js.js.map +1 -1
- package/dist/src/crypto.d.ts +11 -10
- package/dist/src/crypto.d.ts.map +1 -1
- package/dist/src/crypto.js +10 -1
- package/dist/src/crypto.js.map +1 -1
- package/dist/src/encoder.d.ts +5 -10
- package/dist/src/encoder.d.ts.map +1 -1
- package/dist/src/encoder.js +10 -51
- package/dist/src/encoder.js.map +1 -1
- package/dist/src/errors.d.ts +6 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +9 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/index.d.ts +50 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +38 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/logger.d.ts +9 -10
- package/dist/src/logger.d.ts.map +1 -1
- package/dist/src/logger.js +39 -28
- package/dist/src/logger.js.map +1 -1
- package/dist/src/metrics.d.ts +1 -1
- package/dist/src/metrics.d.ts.map +1 -1
- package/dist/src/noise.d.ts +33 -30
- package/dist/src/noise.d.ts.map +1 -1
- package/dist/src/noise.js +122 -78
- package/dist/src/noise.js.map +1 -1
- package/dist/src/nonce.d.ts +2 -3
- package/dist/src/nonce.d.ts.map +1 -1
- package/dist/src/nonce.js +3 -2
- package/dist/src/nonce.js.map +1 -1
- package/dist/src/performHandshake.d.ts +5 -0
- package/dist/src/performHandshake.d.ts.map +1 -0
- package/dist/src/performHandshake.js +69 -0
- package/dist/src/performHandshake.js.map +1 -0
- package/dist/src/proto/payload.d.ts +4 -3
- package/dist/src/proto/payload.d.ts.map +1 -1
- package/dist/src/proto/payload.js +48 -29
- package/dist/src/proto/payload.js.map +1 -1
- package/dist/src/protocol.d.ts +71 -0
- package/dist/src/protocol.d.ts.map +1 -0
- package/dist/src/protocol.js +257 -0
- package/dist/src/protocol.js.map +1 -0
- package/dist/src/types.d.ts +98 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils.d.ts +10 -19
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +159 -57
- package/dist/src/utils.js.map +1 -1
- package/package.json +43 -48
- package/src/constants.ts +1 -0
- package/src/crypto/index.browser.ts +3 -0
- package/src/crypto/index.ts +219 -0
- package/src/crypto/js.ts +25 -27
- package/src/crypto.ts +21 -10
- package/src/encoder.ts +10 -67
- package/src/errors.ts +10 -0
- package/src/index.ts +54 -6
- package/src/logger.ts +46 -32
- package/src/metrics.ts +1 -1
- package/src/noise.ts +176 -131
- package/src/nonce.ts +7 -7
- package/src/performHandshake.ts +91 -0
- package/src/proto/payload.proto +2 -1
- package/src/proto/payload.ts +53 -31
- package/src/protocol.ts +313 -0
- package/src/types.ts +105 -0
- package/src/utils.ts +189 -79
- package/dist/src/@types/basic.d.ts +0 -5
- package/dist/src/@types/basic.d.ts.map +0 -1
- package/dist/src/@types/basic.js +0 -2
- package/dist/src/@types/basic.js.map +0 -1
- package/dist/src/@types/handshake-interface.d.ts +0 -15
- package/dist/src/@types/handshake-interface.d.ts.map +0 -1
- package/dist/src/@types/handshake-interface.js +0 -2
- package/dist/src/@types/handshake-interface.js.map +0 -1
- package/dist/src/@types/handshake.d.ts +0 -40
- package/dist/src/@types/handshake.d.ts.map +0 -1
- package/dist/src/@types/handshake.js +0 -2
- package/dist/src/@types/handshake.js.map +0 -1
- package/dist/src/@types/libp2p.d.ts +0 -10
- package/dist/src/@types/libp2p.d.ts.map +0 -1
- package/dist/src/@types/libp2p.js +0 -2
- package/dist/src/@types/libp2p.js.map +0 -1
- package/dist/src/crypto/streaming.d.ts +0 -7
- package/dist/src/crypto/streaming.d.ts.map +0 -1
- package/dist/src/crypto/streaming.js +0 -50
- package/dist/src/crypto/streaming.js.map +0 -1
- package/dist/src/handshake-xx.d.ts +0 -33
- package/dist/src/handshake-xx.d.ts.map +0 -1
- package/dist/src/handshake-xx.js +0 -139
- package/dist/src/handshake-xx.js.map +0 -1
- package/dist/src/handshakes/abstract-handshake.d.ts +0 -36
- package/dist/src/handshakes/abstract-handshake.d.ts.map +0 -1
- package/dist/src/handshakes/abstract-handshake.js +0 -140
- package/dist/src/handshakes/abstract-handshake.js.map +0 -1
- package/dist/src/handshakes/xx.d.ts +0 -18
- package/dist/src/handshakes/xx.d.ts.map +0 -1
- package/dist/src/handshakes/xx.js +0 -161
- package/dist/src/handshakes/xx.js.map +0 -1
- package/src/@types/basic.ts +0 -5
- package/src/@types/handshake-interface.ts +0 -12
- package/src/@types/handshake.ts +0 -48
- package/src/@types/libp2p.ts +0 -10
- package/src/crypto/streaming.ts +0 -58
- package/src/handshake-xx.ts +0 -177
- package/src/handshakes/abstract-handshake.ts +0 -180
- package/src/handshakes/xx.ts +0 -184
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# @chainsafe/libp2p-noise
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
[](https://github.com/ChainSafe/js-libp2p-noise/actions)
|
|
5
|
+
[](https://libp2p.io/)
|
|
6
|
+

|
|
7
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
[](https://twitter.com/ChainSafeth)
|
|
13
|
+
[](https://discord.gg/Q6A3YA2)
|
|
14
|
+
|
|
15
|
+
> Noise libp2p handshake for js-libp2p
|
|
16
|
+
|
|
17
|
+
# About
|
|
18
|
+
|
|
19
|
+
<!--
|
|
20
|
+
|
|
21
|
+
!IMPORTANT!
|
|
22
|
+
|
|
23
|
+
Everything in this README between "# About" and "# Install" is automatically
|
|
24
|
+
generated and will be overwritten the next time the doc generator is run.
|
|
25
|
+
|
|
26
|
+
To make changes to this section, please update the @packageDocumentation section
|
|
27
|
+
of src/index.js or src/index.ts
|
|
28
|
+
|
|
29
|
+
To experiment with formatting, please run "npm run docs" from the root of this
|
|
30
|
+
repo and examine the changes made.
|
|
31
|
+
|
|
32
|
+
-->
|
|
33
|
+
|
|
34
|
+
This repository contains TypeScript implementation of noise protocol, an encryption protocol used in libp2p.
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
Install with `yarn add @chainsafe/libp2p-noise` or `npm i @chainsafe/libp2p-noise`.
|
|
39
|
+
|
|
40
|
+
Example of using default noise configuration and passing it to the libp2p config:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import {createLibp2p} from "libp2p"
|
|
44
|
+
import {noise} from "@libp2p/noise"
|
|
45
|
+
|
|
46
|
+
//custom noise configuration, pass it instead of `noise()`
|
|
47
|
+
//x25519 private key
|
|
48
|
+
const n = noise({ staticNoiseKey });
|
|
49
|
+
|
|
50
|
+
const libp2p = await createLibp2p({
|
|
51
|
+
connectionEncrypters: [noise()],
|
|
52
|
+
//... other options
|
|
53
|
+
})
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
See the [NoiseInit](https://github.com/ChainSafe/js-libp2p-noise/blob/master/src/noise.ts#L22-L30) interface for noise configuration options.
|
|
57
|
+
|
|
58
|
+
## API
|
|
59
|
+
|
|
60
|
+
This module exposes an implementation of the [ConnectionEncrypter](https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionEncrypter.html) interface.
|
|
61
|
+
|
|
62
|
+
## Bring your own crypto
|
|
63
|
+
|
|
64
|
+
You can provide a custom crypto implementation (instead of the default, based on [@noble](https://paulmillr.com/noble/)) by adding a `crypto` field to the init argument passed to the `Noise` factory.
|
|
65
|
+
|
|
66
|
+
The implementation must conform to the `ICryptoInterface`, defined in <https://github.com/ChainSafe/js-libp2p-noise/blob/master/src/crypto.ts>
|
|
67
|
+
|
|
68
|
+
# Install
|
|
69
|
+
|
|
70
|
+
```console
|
|
71
|
+
$ npm i @chainsafe/libp2p-noise
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Browser `<script>` tag
|
|
75
|
+
|
|
76
|
+
Loading this module through a script tag will make its exports available as `ChainsafeLibp2pNoise` in the global namespace.
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<script src="https://unpkg.com/@chainsafe/libp2p-noise/dist/index.min.js"></script>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
# API Docs
|
|
83
|
+
|
|
84
|
+
- <https://ChainSafe.github.io/js-libp2p-noise>
|
|
85
|
+
|
|
86
|
+
# License
|
|
87
|
+
|
|
88
|
+
Licensed under either of
|
|
89
|
+
|
|
90
|
+
- Apache 2.0, ([LICENSE-APACHE](https://github.com/ChainSafe/js-libp2p-noise/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
|
|
91
|
+
- MIT ([LICENSE-MIT](https://github.com/ChainSafe/js-libp2p-noise/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
|
|
92
|
+
|
|
93
|
+
# Contribution
|
|
94
|
+
|
|
95
|
+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
|