Noise libp2p handshake for js-libp2p
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
dependabot[bot] 45656b5316
chore: update libp2p requirement from 0.44.0-59f34a21 to 0.45.0 (#329)
1 month ago
.github
benchmarks fix!: update hashing libs to @noble (#323) 1 month ago
src chore: bump aegir from 38.1.8 to 39.0.5 (#328) 1 month ago
test chore: bump aegir from 38.1.8 to 39.0.5 (#328) 1 month ago
.aegir.js
.gitignore fix!: update stream types (#316) 1 month ago
.nvmrc
CHANGELOG.md chore(master): release 12.0.0 (#327) 1 month ago
LICENSE
LICENSE-APACHE
LICENSE-MIT
README.md chore: update README.md shields (#326) 1 month ago
SECURITY.md chore: create SECURITY.md (#299) 2 months ago
package.json chore: update libp2p requirement from 0.44.0-59f34a21 to 0.45.0 (#329) 1 month ago
tsconfig.json

README.md

js-libp2p-noise

npm License Apache 2.0 License MIT Twitter Discord

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=@chainsafe/libp2p-noise@latest

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 {noise} from "@chainsafe/libp2p-noise"

//custom noise configuration, pass it instead of `new Noise()`
//x25519 private key
const n = noise(privateKey);

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.

» API Docs

Bring your own crypto

You can provide a custom crypto implementation (instead of the default, based on stablelib) by passing a third argument to the Noise constructor.

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

Contribute

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

License

Licensed under either of