JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 233365
  • Score
    100M100P100Q158266F
  • License MIT

Encrypted Content-Encoding for HTTP

Package Exports

  • http_ece

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (http_ece) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.encrypt(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.