包详细信息

@chainsafe/libp2p-noise

ChainSafe114.4kApache-2.0 OR MIT16.1.3

Noise libp2p handshake for js-libp2p

crypto, libp2p, noise

自述文件

@chainsafe/libp2p-noise

npm License Apache 2.0 License MIT Twitter Discord

Noise libp2p handshake for js-libp2p

About

This repository contains TypeScript implementation of noise protocol, an encryption protocol used in libp2p.

Usage

Install with yarn add @chainsafe/libp2p-noise or npm i @chainsafe/libp2p-noise.

Example of using default noise configuration and passing it to the libp2p config:

import {createLibp2p} from "libp2p"
import {noise} from "@chainsafe/libp2p-noise"

//custom noise configuration, pass it instead of `noise()`
//x25519 private key
const n = noise({ staticNoiseKey });

const libp2p = await createLibp2p({
  connectionEncrypters: [noise()],
  //... other options
})

See the NoiseInit interface for noise configuration options.

API

This module exposes an implementation of the ConnectionEncrypter interface.

Bring your own crypto

You can provide a custom crypto implementation (instead of the default, based on @noble) by adding a crypto field to the init argument passed to the Noise factory.

The implementation must conform to the ICryptoInterface, defined in https://github.com/ChainSafe/js-libp2p-noise/blob/master/src/crypto.ts

Install

$ npm i @chainsafe/libp2p-noise

Browser <script> tag

Loading this module through a script tag will make its exports available as ChainsafeLibp2pNoise in the global namespace.

<script src="https://unpkg.com/@chainsafe/libp2p-noise/dist/index.min.js"></script>

API Docs

License

Licensed under either of

Contribution

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.

更新日志

16.1.3 (2025-04-23)

Bug Fixes

  • support handshake-only with no muxers (#519) (fd0e4f2)

16.1.2 (2025-04-16)

Dependencies

  • dev: bump it-byte-stream from 1.1.0 to 2.0.1 (#506) (1878931)

16.1.1 (2025-04-16)

Dependencies

  • bump it-length-prefixed-stream from 1.2.0 to 2.0.1 (#508) (859f7f9)

16.1.0 (2025-03-20)

Features

16.0.3 (2025-02-21)

Bug Fixes

  • bump @chainsafe/as-sha256 from 0.4.2 to 1.0.0 (#439) (50e080c)

16.0.2 (2025-02-20)

Dependencies

  • bump @noble/ciphers from 0.6.0 to 1.1.3 (#461) (0b9ce35)
  • dev: bump aegir from 44.1.4 to 45.0.8 (#462) (2f07e64)
  • dev: bump sinon from 18.0.1 to 19.0.2 (#454) (0b9c7bc)

16.0.1 (2025-01-21)

Bug Fixes

16.0.0 (2024-09-11)

⚠ BREAKING CHANGES

  • Can only be used with libp2p@2.x.x or later

Features

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

15.1.2 (2024-08-29)

Bug Fixes

15.1.1 (2024-08-13)

Bug Fixes

15.1.0 (2024-06-24)

Features

Bug Fixes

  • bump @noble/ciphers from 0.4.1 to 0.5.1 (#419) (cd2910a)

15.0.0 (2024-01-17)

⚠ BREAKING CHANGES

  • refactor codebase (#407)

Features

Bug Fixes

  • bump @libp2p/crypto from 3.0.4 to 4.0.0 (#414) (0ffa85f)

14.1.0 (2023-12-09)

Features

Bug Fixes

14.0.0 (2023-11-29)

⚠ BREAKING CHANGES

  • yield uint8arraylists instead of concatenating buffers (#391)

Bug Fixes

  • yield uint8arraylists instead of concatenating buffers (#391) (ad25a5e)

13.0.5 (2023-11-27)

Bug Fixes

13.0.4 (2023-11-24)

Bug Fixes

13.0.3 (2023-11-13)

Bug Fixes

  • concatenate encrypted data length prefix with data before sending (#387) (2be73dc)
  • use native crypto if available (#385) (3dee1dc)

13.0.2 (2023-10-23)

Bug Fixes

  • bump @noble/ciphers from 0.3.0 to 0.4.0 (#370) (4b86c41)

13.0.1 (2023-09-04)

Bug Fixes

  • reuse output when decrypting using noble/ciphers (#345) (6263eed)

13.0.0 (2023-08-03)

⚠ BREAKING CHANGES

  • stream close methods are now asyc, requires libp2p@0.46.x or later

Features

12.0.2 (2023-07-17)

Bug Fixes

12.0.1 (2023-05-22)

Bug Fixes

  • add missing file extension in import (#331) (b578438)

12.0.0 (2023-05-08)

⚠ BREAKING CHANGES

  • stablelib crypto backend renamed to pureJsCrypto
  • the type of the source/sink properties have changed

Bug Fixes

  • update hashing libs to noble, stablelib crypto backend renamed to pureJsCrypto (3732fda)
  • update stream types (#316) (8426920)

11.0.4 (2023-03-28)

Bug Fixes

  • add types to exports in packages.json (#302) (9d4cd3b)

11.0.3 (2023-03-28)

Bug Fixes

11.0.2 (2023-03-27)

Bug Fixes

11.0.1 (2023-02-20)

Bug Fixes

  • Add peer id str to mismatch error (1990c6f)

11.0.0 (2023-01-06)

⚠ BREAKING CHANGES

  • update multiformats and related dependencies (#257)

Bug Fixes

Miscellaneous

10.2.0 (2022-11-22)

Features

  • reuse encrypted data to avoid memory allocation (#242) (0b4b7f6)
  • reused ciphertext allocation in decrypt function (0b4b7f6)

10.1.0 (2022-11-15)

Features

10.0.1 (2022-10-31)

Bug Fixes

Miscellaneous

10.0.0 (2022-10-19)

⚠ BREAKING CHANGES

  • modules no longer implement Initializable instead switching to constructor injection

Bug Fixes

Miscellaneous

  • bump @libp2p/tcp from 3.1.2 to 4.1.0 (#227) (3bc8ed4)

9.0.0 (2022-10-06)

⚠ BREAKING CHANGES

  • add Noise Extensions and update deps (#215)

Features

  • add Noise Extensions and update deps (#215) (ed3e16b)

Miscellaneous

8.0.2 (2022-10-03)

Bug Fixes

Miscellaneous

8.0.1 (2022-08-19)

Bug Fixes

  • only increment nonce in valid decrypted msg (#200) (393c169)

Miscellaneous

8.0.0 (2022-08-11)

⚠ BREAKING CHANGES

  • update protons and connection encryption interface (#193)
  • remove noise pipes option (#177)
  • remove default instance (#188)

Features

Bug Fixes

Miscellaneous

7.0.3 (2022-08-03)

Bug Fixes

  • correct type of it-length-prefixed 8.0.2 (#178) (45c1d56)

Miscellaneous

  • correct type of it-length-prefixed 8.0.2 (45c1d56)

7.0.2 (2022-08-02)

Miscellaneous

7.0.1 (2022-06-23)

Bug Fixes

7.0.0 (2022-06-17)

⚠ BREAKING CHANGES

  • updates to the single-issue libp2p interface definitions

Miscellaneous

6.2.0 (2022-05-23)

Features

  • adjust to comply with conn encryptor spec (#153) (0fd6a63)

6.1.2 (2022-05-23)

Miscellaneous

6.1.1 (2022-04-14)

Bug Fixes

  • use protons instead of protobuf for native .proto to .ts (#141) (2ad93fa)

Miscellaneous

  • align release with chainsafe (a2f2d5f)

[6.1.0]

  • enable using own crypto library

    [6.0.1]

  • Fix global env access in browser

    [6.0.0]

    BREAKING CHANGE

  • switch to esm

[5.0.3]

  • Fix handshake signature verification #129

[5.0.2]

  • Fix write handshake nonce correctly which made this version incompatible with other implementations #129

[5.0.1]

  • Fix API docs link #124
  • remove node buffers #125
  • safely handle nonces as 64 bit uints #118

[5.0.0]

BREAKING CHANGE

  • update peer-id and libp2p-crypto (requires nodejs v15+) #116

[4.1.1]

Added

  • Bump libp2p deps for uint8arrays@3.0.0 #108

[4.1.0]

Added

  • Updated uint8arrays version to 3.0.0

[4.0.0]

Breaking

  • the new peer-id module uses the new CID class and not the old one

[3.1.0]

Added

  • Replaced bcrypto dependency
  • Add support for node 15

[3.0.0]

  • Updates all deps to pull in the latest buffer and bl modules
  • Specifies a root name for pbjs code gen - message names for pbjs generated code are global so specifying a root name scopes them to prevent two modules accidentally trampling over each other's protobuf code by giving their messages the same name

    Breaking

  • buffer@6 dropped support for IE and Safari < 10

[2.0.5]

Bugfixes

  • update aegir to latest
  • update dependencies

[2.0.4]

Bugfixes

  • downgrade aegir because js files are missing in dist directory

    [2.0.3]

Bugfixes

  • update peer-id dependency

[2.0.2]

Bugfixes

  • update dependencies

[2.0.1]

Bugfixes

  • security update for bl dependency
  • add missing type declaration files in dist

[2.0.0]

Features

  • switched to aegir for building and linting
  • using peer id with Uint8Arrays (breaking!)

[1.1.2]

Bugfixes

  • fix issue where web build depends on global regeneratorRuntime

[1.1.1] - 2020-05-08

Bugfixes

  • fix issue #58

[1.1.0] - 2020-04-23

Stable version, interoperable with go.

Using reduced size with bcrypto.

[1.1.0-rc.1] - 2020-04-22

  • Added early data API
  • Dumping session keys
  • Reducing package size

[1.0.0]

Stable version, interobable with go-libp2p-noise!

Bugfixes

  • fix types to be compatible with rest of libp2p typescript projects
  • update it-pb-rpc to 0.1.8 (contains proper typescript types)

Bugfixes

  • changed bcrypto imports to use pure js versions (web bundle size reduction)

[1.0.0-rc.9] - 2019-03-11

Bugfixes

  • return handshake remote peer from secureOutbound
  • fix browser usage of buffer

[1.0.0-rc.8] - 2019-03-05

Breaking changes

  • Disabled noise pipes

Bugfixes

  • fixed empty ephemeral bug in XX
  • verification of AEAD decryption

[1.0.0-rc.7] - 2019-02-20

Bugfixes

  • attach/remove aead auth tag on cyphertext

[1.0.0-rc.6] - 2019-02-20

Bugfixes

  • attach/remove aead auth tag on cyphertext
  • better protobuf handling (static module generation)

[1.0.0-rc.5] - 2019-02-10

Bugfixes

  • fix module compiling in node 10 (class properties)

[1.0.0-rc4] - 2019-02-10

Bugfixes

  • resolved bug with key cache and null remote peer
  • fixed IK flow as initiator and responder