open-index/open-npm huggingface dataset:
npm package: @likecoin/noise-js
Description: Pure Javascript implementation of the Noise Protocol Framework
Author: Enyk Limited
Latest version: 0.1.0
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# `noise-js`

> Javascript implementation of the Noise Protocol Framework that works in both browsers and Node.js

Note that this implementation is low level and requires knowledge of the
[Noise Protocol Framework](http://noiseprotocol.org/noise.html), and is aimed to
be a building block for higher-level modules wishing to implement
application-specific handshakes securely.

## Supported Features

### DH functions, cipher functions, and hash functions

- `25519`
- `AESGCM`
- `SHA256`

### Patterns

All one-way and fundamental handshake patterns are currently supported:

- `N`
- `K`
- `X`
- `NN`
- `KN`
- `NK`
- `KK`
- `NX`
- `KX`
- `XN`
- `IN`
- `XK`
- `IK`
- `XX`
- `IX`

### Modifiers

- `psk`

## Usage

```js
var noise = require('noise-js')

var sClient = noise.generateKeypair()
var sServer = noise.generateKeypair()

// Initialize a Noise_KK_25519_AESGCM_SHA256 handshake
var client = noise.initialize('KK', true, Buffer.alloc(0), sClient, null, sServer.publicKey)
var server = noise.initialize('KK', false, Buffer.alloc(0), sServer, null, sClient.publicKey)

// -> e, es, ss
var clientTx = client.writeMessage(Buffer.alloc(0))
var serverRx = server.readMessage(clientTx)

// <- e, ee, se
var serverTx = server.writeMessage(Buffer.alloc(0))
var serverSplit = server.split()
var clientRx = client.readMessage(serverTx)
var clientSplit = client.split()

// Can now do transport encryption with splits
console.log(serverSplit)
console.log(clientSplit)
```

## License

[Apache License 2.0](LICENSE)

Portions of this product may utilize third party copyrighted material, the use of which is
acknowledged in the [NOTICE](NOTICE) file.