Skip to content
Privacy-preserving cloud infrastructure by evervault
JavaScript
Branch: master
Clone or download
Latest commit 15d7659 Sep 25, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist Added README Sep 25, 2019
.gitignore Initial v0.1.0 commit Sep 25, 2019
README.md New README Sep 25, 2019
browser.js Added README Sep 25, 2019
index.js Added README Sep 25, 2019
logo.png reducing logo size Sep 25, 2019
package-lock.json Added README Sep 25, 2019
package.json New README Sep 25, 2019

README.md

Version Downloads/week License

Installation

This is a Node.js module available through the npm registry. It can be installed using the npm or yarn command line tools.

npm install evervault --save

Getting Started

const evervault = require('evervault')('YOUR_API_KEY')

// Deploy an evervault cage from a Node.js function
evervault.cages.deploy(function () {
  // For example, calculate the distance between the two latitude/longitude pairs
  const location = params.location.split(",")
  const destination = params.destination.split(",")

  let radlat1 = Math.PI * parseFloat(location[0]) / 180
  let radlat2 = Math.PI * parseFloat(destination[0]) / 180

  let theta = parseFloat(location[1]) - parseFloat(destination[1])
  let radtheta = Math.PI * theta / 180

  let dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta)

  if (dist > 1) {
    dist = 1;
  }

  dist = Math.acos(dist);
  dist = dist * 180 / Math.PI;
  dist = dist * 60 * 1.1515 * 1.609344;

  send(JSON.stringify({
    distanceBetweenPoints: dist
  }))
}, function (err, cage) {
  console.log("Successfully deployed cage " + cage.name)
});

// List all of the cages that have been deployed on your account
evervault.cages.list(function (err, cages) {
  console.log(err, cages);
});

// Encrypt an object to be processed by preset evervault cages
evervault.data.encrypt(["mute-butterfly-4924", "noisy-rain-3981"], {
  message: "this will be encrypted using a key known only to the specified evervault cages",
  location: "53.349293,-6.247709",
  destination: "37.421533,-122.212311"
}, function (err, result) {
  // We now have an encrypted object which can be read by cages `mute-butterfly-4924` and `noisy-rain-3981`
  // Save it to your database, or send it straight to the cage to be processed.
});

Dependencies

  • aes-js: A pure JavaScript implementation of the AES block cipher and all common modes of operation.
  • node-webcrypto-ossl: A WebCrypto Polyfill for Node in TypeScript built on OpenSSL
  • request: Simplified HTTP request client.

License

MIT

You can’t perform that action at this time.