# signal-stream

> encrypt and decrypt streams with signal-protocol

Latest version **0.0.8** (published 2016-12-20) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install signal-stream
pnpm add signal-stream
yarn add signal-stream
bun add signal-stream
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2016-12-20 |
| First published | 2016-12-20 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | elsehow |
| Maintainers | elsehow |

## Links

- npm: https://www.npmjs.com/package/signal-stream
- npm.io page: https://npm.io/package/signal-stream

## Dependencies (5)

- [pumpify](https://npm.io/package/pumpify.md) ^1.3.5
- [through2](https://npm.io/package/through2.md) ^2.0.3
- [hypercore](https://npm.io/package/hypercore.md) ^4.16.0
- [JSONStream](https://npm.io/package/JSONStream.md) ^1.3.0
- [concat-stream](https://npm.io/package/concat-stream.md) ^1.6.0

## Recent versions

- 0.0.8 (latest) — 2016-12-20
- 0.0.7 — 2016-12-20
- 0.0.6 — 2016-12-20
- 0.0.4 — 2016-12-20
- 0.0.3 — 2016-12-20
- 0.0.2 — 2016-12-20
- 0.0.1 — 2016-12-20

## README

# signal-stream

```
npm install signal-stream
```

encrypt and decrypt streams 
using the [signal-protocol](https://github.com/elsehow/signal-protocol)

[![Build Status](https://travis-ci.org/elsehow/signal-protocol.svg?branch=master)](https://travis-ci.org/elsehow/signal-protocol)


## example

```javascript
var signalstream = require('signal-stream')
var signal = require('signal-protocol')
var h = require('signal-stream/test/helpers')(signal)

h.bobAliceSessionCiphers()
  .then(([aliceCipher, bobCipher]) => {
    let alice = signalstream(aliceCipher)
    let bob = signalstream(bobCipher)
    require('http')
      .get({
        hostname:'info.cern.ch',
        path: '/hypertext/WWW/TheProject.html',
      }, res => {
        res
          .pipe(alice.encrypt)
          .pipe(bob.decrypt)
          .pipe(bob.encrypt)
          .pipe(alice.decrypt)
          .on('data', d =>
              console.log(d.toString()))
      })
  })
  
// <HEADER>
// <TITLE>The World Wide Web project</TITLE>
// ...
```

see `examples/` for more.

## api

### signalstream(sessionCipher, opts)

returns an object `{ encrypt, decrypt }`.

`encrypt` is a transform stream that consumes (plaintext) buffers and produces (encrypted) ciphertext objects (refer to [signal-protocol](https://github.com/elsehow/signal-protocol) for details).

`decrypt` is a transform stream that consumes signal-protocol's ciphertext objects and produces plaintext buffers.

the default `opts` are

```js
{
  jsonIn: false,
  jsonOut: false,
}
```

setting these to `true` can be helpful if you need to (de-)serialize the objects produced by signal-protocol's `encrypt`, e.g. to send over a websocket or a network. (see `examples/net.js`).

## license

BSD

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