Evervault makes it easy to encrypt data at source, process it in a Cage — a secure, serverless function — and never store it unencrypted.
This is a simple Evervault Cage example, to help get you up and running on the Evervault platform quickly, using an external API (Twilio).
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 cage to be processed securely.
This Cage takes a payload that should contain two keys, body
and to
, representing the message and the number this message will be sent to.
- Encrypt your data at source, using either the Node SDK or Browser and React SDKs.
- Process the encrypted data in a cage
// This example uses the Evervault Node SDK.
const Evervault = require('@evervault/sdk');
// Initialize the client with your team’s API key
const evervault = new Evervault('<YOUR-API-KEY>');
// Encrypt your data
const encrypted = await evervault.encrypt({ body: 'Hey there from Evervault!', to: '+3538972215123' });
You should encrypt this payload using either our Node SDK or Browser SDK, then run it in the Hello Cage:
// Process the encrypted data in a Cage
const result = await evervault.run('twilio-cage', encrypted);
This cage is very simple, here is the full code:
const accountSid = process.env.TWILIO_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = require('twilio')(accountSid, authToken);
exports.handler = async (data) => {
const msg = await client.messages
.create({
body: data.body,
from: process.env.TWILIO_NUMBER,
to: data.to
});
return msg;
};
Or check it out in index.js.
In this cage we are using some environment variables. TWILIO_SID
, TWILIO_AUTH_TOKEN
and TWILIO_NUMBER
. You can get your own values for these by signing up for Twilio.
When you have them, you can populate them in the Cage view in the Evervault dashboard.
If you want to know more about Evervault, check out our documentation.