e3x: End-to-End Encrypted eXchange (javascript)
This module implements all of e3x in javascript as a node and browserify module. It is used by telehash-js which is designed to provide a friendly higher level api, whereas this is low level and expects the application to manage all state tracking.
Usage
All packets use lob-enc structure of: {json:{...}, body:Buffer(...)}
var e3x = ; var secrets = e3x; var self = e3xselfargs;if!self //console.log(e3x.err); var inner = self; var exchange = self;if!exchange //console.log(self.err); exchangetoken; // 16 byte bufferexchange{ } var bool = exchange;var message = exchange; var inner = exchange; var at = exchange; // set the at, or return the current one if none given, will start to timeout channels until in syncvar bool = exchange; // processes handshake to do all setup stuff, resends channels if in syncvar handshake = exchange; // returns current handshake to be sent var channel = exchange;if!channel //console.log(exchange.err); var bool = channel; // true if acceptedchannel; // calls exchange.sending()channelstate;channel{};
Cipher Sets
These are the current Cipher Sets supported by default:
The API to implement a new CS module is just a simplified crypto wrapper:
var cs = ;csid; // 'xx'; cs; // new local keypair, cb(err, pair) var local = pair;var inner = local; var remote = public_key_endpoint;var bool = remote;var outer = remote; var ephemeral = remote body;var outer = ephemeralvar inner = ephemeral