secret-stream
secret-stream ===
Last updated 5 years ago by cwmma .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install secret-stream 
SYNC missed versions from official npm registry.

secret-stream

var yourPair = cipherStream(curve, yourPrivate, theirPublic);
var theirPair = cipherStream(curve, theirPrivate, yourPublic);
yourPair.secret.pipe(theirPair.secret);
theirPair.secret.pipe(yourPair.secret);

theirPair.plain.on('data', function (d) {
  if (d.toString() === 'hello') {
    theirPair.plain.write('hello yourself');
  }
});
yourPair.plain.on('data', function (d) {
  //'hello yourself'
});
yourPair.plain.write('hello');

takes 3 arguments all are optional.

  1. elliptical curve type, defaults to secp256k1, other options include secp224r1, prime256v1, prime192v1, ed25519, and curve25519.
  2. your private ECDH key
  3. their public ECDH key

It always creates an ephemeral ECDH key pair to exchange, if you also include your private long-term identity ECDH key and their public long-term identity ECDH key it will generate the key by combining

  • your ephemeral private key and their ephemeral public key
  • your private long-term ECDH key and their ephemeral public key
  • your ephemeral private key and their long-term public key

Sses crypto-stream under the hood for the actual encryption.

under no circumstances should this be used for real life things that need to be kept secret

seriously it's for a learning.

Current Tags

  • 1.0.0                                ...           latest (5 years ago)

1 Versions

  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (8)
Dev Dependencies (2)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |