This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/node_modules/http_ece
cranberry ed23347e56 Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
..
README.md Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
ece.js Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
package.json Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
package.json~ Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00
tmp.js~ Initial comission of TheLounge base files 2020-11-01 22:46:04 +00:00

README.md

encrypted-content-encoding

A simple implementation of the HTTP encrypted content-encoding

Use

var ece = require('http_ece');
var crypto = require('crypto')
var base64 = require('base64url');

var parameters = {
  key: base64.encode(crypto.randomBytes(16)),
  salt: base64.encode(crypto.randomBytes(16))
};
var encrypted = ece.encrypt(data, parameters);

var decrypted = ece.decrypt(encrypted, parameters);

require('assert').equal(decrypted.compare(data), 0);

This also supports the static-ephemeral ECDH mode. The source explains how.

TODO

Use the node streams API instead of the legacy APIs.