GithubHelp home page GithubHelp logo

node-evervault's Introduction

Hello Function

Evervault makes it easy to encrypt data at source, process it in a Function โ€” a secure, serverless function โ€” and never store it unencrypted.

This is a simple Evervault Function example, to help get you up and running on the Evervault platform quickly.

Getting started with Evervault

Evervault consists of two parts, encrypting your data at source, using either our Node SDK, or Browser and React SDKs and then sending that encrypted data to a Function to be processed securely.

This Function takes a payload that should contain a name key. Running the Function is very simple.

The steps

  1. Encrypt your data at source, using one of our SDKs.
  2. Process the encrypted data in a Function

Encrypting at source

// This example uses the Evervault Node SDK.
const Evervault = require('@evervault/sdk');

// Initialize the client with your App's API key
const evervault = new Evervault('<YOUR-API-KEY>');

// Encrypt your data
const encrypted = await evervault.encrypt({ name: 'Claude Shannon' });

Process your encrypted data in a Function

You should encrypt this payload using either our Node SDK or Browser SDK, then run it in the Hello Function:

// Process the encrypted data in a Function
const result = await evervault.run('<YOUR_FUNCTION_NAME>', encrypted);

Understanding the Function

This Function is very simple. Here is the full code:

exports.handler = async (data) => {
  if (data.name && typeof data.name === "string") {
    console.debug(`A name of length ${data.name.length} has arrived into the Function.`);

    return {
      message: `Hello from a Function! It seems you have ${data.name.length} letters in your name`,
      name: await context.encrypt(data.name),
    };
  } else {
    console.debug('An empty name has arrived into the Function.');

    return {
      message: 'Hello from a Function! Send an encrypted `name` parameter to show Function decryption in action',
    };
  }
};

Or check it out in index.js.


If you want to know more about Evervault, check out our documentation.

node-evervault's People

Contributors

monixxxx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.