# @chainsafe/libp2p-noise

> Noise libp2p handshake for js-libp2p

Latest version **17.0.0** (published 2025-09-25) · Apache-2.0 OR MIT license · 0 weekly downloads

## Install

```sh
npm install @chainsafe/libp2p-noise
pnpm add @chainsafe/libp2p-noise
yarn add @chainsafe/libp2p-noise
bun add @chainsafe/libp2p-noise
```

## Health

**Score 70/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 17.0.0 |
| Published | 2025-09-25 |
| First published | 2021-07-29 |
| Weekly downloads | 0 |
| License | Apache-2.0 OR MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 13 |
| Unpacked size | 1.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 43 |
| Author | ChainSafe |
| Maintainers | wemeetagain |
| Keywords | crypto, libp2p, noise |

## Links

- npm: https://www.npmjs.com/package/@chainsafe/libp2p-noise
- Repository: https://github.com/ChainSafe/js-libp2p-noise
- Homepage: https://github.com/ChainSafe/js-libp2p-noise#readme
- Issues: https://github.com/ChainSafe/js-libp2p-noise/issues
- npm.io page: https://npm.io/package/@chainsafe/libp2p-noise

## Dependencies (13)

- [wherearewe](https://npm.io/package/wherearewe.md) ^2.0.1
- [uint8arrays](https://npm.io/package/uint8arrays.md) ^5.1.0
- [@libp2p/utils](https://npm.io/package/@libp2p/utils.md) ^7.0.0
- [@noble/curves](https://npm.io/package/@noble/curves.md) ^2.0.1
- [@noble/hashes](https://npm.io/package/@noble/hashes.md) ^2.0.1
- [@libp2p/crypto](https://npm.io/package/@libp2p/crypto.md) ^5.1.9
- [@noble/ciphers](https://npm.io/package/@noble/ciphers.md) ^2.0.1
- [uint8arraylist](https://npm.io/package/uint8arraylist.md) ^2.4.8
- [@libp2p/peer-id](https://npm.io/package/@libp2p/peer-id.md) ^6.0.0
- [protons-runtime](https://npm.io/package/protons-runtime.md) ^5.6.0
- [@libp2p/interface](https://npm.io/package/@libp2p/interface.md) ^3.0.0
- [@chainsafe/as-sha256](https://npm.io/package/@chainsafe/as-sha256.md) ^1.2.0
- [@chainsafe/as-chacha20poly1305](https://npm.io/package/@chainsafe/as-chacha20poly1305.md) ^0.1.0

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 17.0.0 (latest) — 2025-09-25
- 16.1.5 — 2025-09-22
- 16.1.4 — 2025-06-26
- 16.1.3 — 2025-04-23
- 16.1.2 — 2025-04-16
- 16.1.1 — 2025-04-16
- 16.1.0 — 2025-03-20
- 16.0.3 — 2025-02-21
- 16.0.2 — 2025-02-20
- 16.0.1 — 2025-01-21
- 16.0.0 — 2024-09-11
- 15.1.2 — 2024-08-30
- 15.1.1 — 2024-08-13
- 15.1.0 — 2024-06-25
- 15.0.0 — 2024-01-17
- … 40 more at https://npm.io/package/@chainsafe/libp2p-noise/versions

## README

# @chainsafe/libp2p-noise

![npm](https://img.shields.io/npm/v/@chainsafe/libp2p-noise)
[![](https://img.shields.io/github/actions/workflow/status/ChainSafe/js-libp2p-noise/js-test-and-release.yml?branch=master)](https://github.com/ChainSafe/js-libp2p-noise/actions)
[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/)
![](https://img.shields.io/github/issues-raw/ChainSafe/js-libp2p-noise)
[![License Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![License MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![](https://img.shields.io/badge/npm-%3E%3D7.0.0-orange.svg?style=flat-square)
![](https://img.shields.io/badge/Node.js-%3E%3D16.0.0-orange.svg?style=flat-square)
![](https://img.shields.io/badge/browsers-last%202%20versions%2C%20not%20ie%20%3C%3D11-orange)
[![Twitter](https://img.shields.io/twitter/follow/ChainSafeth.svg?label=Twitter)](https://twitter.com/ChainSafeth)
[![Discord](https://img.shields.io/discord/593655374469660673.svg?label=Discord\&logo=discord)](https://discord.gg/Q6A3YA2)

> Noise libp2p handshake for js-libp2p

# About

<!--

!IMPORTANT!

Everything in this README between "# About" and "# Install" is automatically
generated and will be overwritten the next time the doc generator is run.

To make changes to this section, please update the @packageDocumentation section
of src/index.js or src/index.ts

To experiment with formatting, please run "npm run docs" from the root of this
repo and examine the changes made.

-->

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:

```ts
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](https://github.com/ChainSafe/js-libp2p-noise/blob/master/src/noise.ts#L22-L30) interface for noise configuration options.

## API

This module exposes an implementation of the [ConnectionEncrypter](https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionEncrypter.html) interface.

## Bring your own crypto

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.

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

# Install

```console
$ 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.

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

# API Docs

- <https://ChainSafe.github.io/js-libp2p-noise>

# License

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](https://github.com/ChainSafe/js-libp2p-noise/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](https://github.com/ChainSafe/js-libp2p-noise/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

# 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.

---
_Source: https://npm.io/package/@chainsafe/libp2p-noise · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
