# @hashprotocol/libp2p-noise

> ![npm](https://img.shields.io/npm/v/libp2p-noise) [![CI](https://github.com/hashprotocol/js-libp2p-noise/actions/workflows/ci.yml/badge.svg?branch=master&event=push)](https://github.com/hashprotocol/js-libp2p-noise/actions/workflows/ci.yml)

Latest version **6.0.2** (published 2022-04-21) · Apache-2.0 OR MIT license · 0 weekly downloads

## Install

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

## Health

**Score 30/100 (F)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.0.2 |
| Published | 2022-04-21 |
| First published | 2022-04-21 |
| Weekly downloads | 0 |
| License | Apache-2.0 OR MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=16.0.0 |
| Dependencies | 15 |
| Unpacked size | 62.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Hash Protocol |
| Maintainers | hashbridge |
| Keywords | crypto, libp2p, noise |

## Links

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

## Dependencies (15)

- [it-pair](https://npm.io/package/it-pair.md) ^2.0.2
- [it-pipe](https://npm.io/package/it-pipe.md) ^2.0.3
- [uint8arrays](https://npm.io/package/uint8arrays.md) ^3.0.0
- [it-pb-stream](https://npm.io/package/it-pb-stream.md) ^1.0.2
- [@libp2p/logger](https://npm.io/package/@libp2p/logger.md) ^1.1.2
- [uint8arraylist](https://npm.io/package/uint8arraylist.md) ^1.4.0
- [@libp2p/peer-id](https://npm.io/package/@libp2p/peer-id.md) ^1.1.8
- [@stablelib/hkdf](https://npm.io/package/@stablelib/hkdf.md) ^1.0.1
- [protons-runtime](https://npm.io/package/protons-runtime.md) ^1.0.3
- [@stablelib/sha256](https://npm.io/package/@stablelib/sha256.md) ^1.0.1
- [@stablelib/x25519](https://npm.io/package/@stablelib/x25519.md) ^1.0.1
- [@libp2p/interfaces](https://npm.io/package/@libp2p/interfaces.md) ^1.3.14
- [it-length-prefixed](https://npm.io/package/it-length-prefixed.md) ^7.0.1
- [@libp2p/peer-collections](https://npm.io/package/@libp2p/peer-collections.md) ^1.0.0
- [@stablelib/chacha20poly1305](https://npm.io/package/@stablelib/chacha20poly1305.md) ^1.0.1

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

- 6.0.2 (latest) — 2022-04-21
- 5.0.3 — 2022-04-21
- 6.1.1 — 2022-04-21

## README

# js-libp2p-noise

![npm](https://img.shields.io/npm/v/libp2p-noise)
[![CI](https://github.com/hashprotocol/js-libp2p-noise/actions/workflows/ci.yml/badge.svg?branch=master&event=push)](https://github.com/hashprotocol/js-libp2p-noise/actions/workflows/ci.yml)

[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](https://libp2p.io/)
![](https://img.shields.io/github/issues-raw/hashprotocol.io/js-libp2p-noise)
![](https://img.shields.io/github/license/hashprotocol.io/js-libp2p-noise)
![](https://img.shields.io/badge/yarn-%3E%3D1.17.0-orange.svg?style=flat-square)
![](https://img.shields.io/badge/Node.js-%3E%3D10.19.0-orange.svg?style=flat-square)
![](https://img.shields.io/badge/browsers-last%202%20versions%2C%20not%20ie%20%3C%3D11-orange)
[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io)

> Noise libp2p handshake for js-libp2p

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

##### Warning: Even though this package works in browser, it will bundle around 600Kb (200Kb gzipped) of code
https://bundlephobia.com/result?p=@hashprotocol.io/libp2p-noise@latest

## Usage

Install with `yarn add @hashprotocol.io/libp2p-noise` or `npm i @hashprotocol.io/libp2p-noise`.

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

```js
import {NOISE, Noise} from "@hashprotocol.io/libp2p-noise"


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

const libp2p = new Libp2p({
   modules: {
     connEncryption: [NOISE],
   },
});
```

Where parameters for Noise constructor are:
 - *static Noise key* - (optional) existing private Noise static key
 - *early data* - (optional) an early data payload to be sent in handshake messages



## API

This module exposes a crypto interface, as defined in the repository [js-interfaces](https://github.com/libp2p/js-interfaces).

[» API Docs](https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-interfaces/src/crypto#api)

## Bring your own crypto

You can provide a custom crypto implementation (instead of the default, based on [stablelib](https://www.stablelib.com/)) by passing a third argument to the `Noise` constructor.

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

## Contribute

Feel free to join in. All welcome. Open an issue!

[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md)

## License

Licensed under either of

 * Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / http://www.apache.org/licenses/LICENSE-2.0)
 * MIT ([LICENSE-MIT](LICENSE-MIT) / http://opensource.org/licenses/MIT)

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