0.0.8 • Published 7 years ago

signal-stream v0.0.8

Weekly downloads
1
License
BSD-3-Clause
Repository
-
Last release
7 years ago

signal-stream

npm install signal-stream

encrypt and decrypt streams using the signal-protocol

Build Status

example

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 for details).

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

the default opts are

{
  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

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago