Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@evervault/sdk

Package Overview
Dependencies
Maintainers
5
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evervault/sdk - npm Package Compare versions

Comparing version 5.0.0 to 5.1.0

lib/core/attestationDoc.js

3

lib/config.js

@@ -8,2 +8,3 @@ const { version } = require('../package.json');

const DEFAULT_CAGES_HOSTNAME = 'cage.evervault.com';
const DEFAULT_ENCLAVES_HOSTNAME = 'enclave.evervault.com';
const DEFAULT_POLL_INTERVAL = 5;

@@ -23,2 +24,4 @@ const DEFAULT_MAX_FILE_SIZE_IN_MB = 25;

cagesHostname: process.env.EV_CAGES_HOSTNAME || DEFAULT_CAGES_HOSTNAME,
enclavesHostname:
process.env.EV_ENCLAVES_HOSTNAME || DEFAULT_ENCLAVES_HOSTNAME,
pollInterval: process.env.EV_POLL_INTERVAL || DEFAULT_POLL_INTERVAL,

@@ -25,0 +28,0 @@ attestationDocPollInterval:

8

lib/core/http.js

@@ -103,4 +103,6 @@ const { errors, Datatypes } = require('../utils');

const getCageAttestationDoc = async (cageName, appUuid) => {
let url = `https://${cageName}.${appUuid}.${config.cagesHostname}/.well-known/attestation`;
const getAttestationDoc = async (cageName, appUuid, hostname) => {
let url = `https://${cageName}.${appUuid}.${
hostname ? hostname : config.cagesHostname
}/.well-known/attestation`;
const response = await phin({

@@ -290,4 +292,4 @@ url,

createToken,
getCageAttestationDoc,
getAttestationDoc,
};
};

@@ -6,4 +6,4 @@ module.exports = {

RelayOutboundConfig: require('./relayOutboundConfig'),
AttestationDoc: require('./cageAttestationDoc'),
CagePcrManager: require('./cagePcrManager'),
AttestationDoc: require('./attestationDoc'),
PcrManager: require('./pcrManager'),
};

@@ -34,2 +34,5 @@ declare module '@evervault/sdk' {

createRelayHttpsAgent: () => HttpsProxyAgent;
/**
* @deprecated use enableEnclaves instead
*/
enableCages: (

@@ -36,0 +39,0 @@ cageAttestationData: Record<

@@ -5,3 +5,2 @@ const crypto = require('crypto');

const { Buffer } = require('buffer');
const util = require('util');

@@ -13,3 +12,3 @@ const {

httpsHelper,
cageAttest,
attest,
} = require('./utils');

@@ -22,3 +21,3 @@ const Config = require('./config');

AttestationDoc,
CagePcrManager,
PcrManager,
} = require('./core');

@@ -31,2 +30,10 @@ const { TokenCreationError } = require('./utils/errors');

/**
* @typedef PCRs
* @property {string | undefined} PCR0
* @property {string | undefined} PCR1
* @property {string | undefined} PCR2
* @property {string | undefined} PCR8
*/
class EvervaultClient {

@@ -84,11 +91,8 @@ static CURVES = {

/**
* @deprecated use enableCages instead
* @deprecated use enableEnclaves instead
*/
async enableCagesBeta(cagesAttestationData) {
if (cageAttest.hasAttestationBindings()) {
await cageAttest.trustCagesRootCA(this.http);
cageAttest.addAttestationListenerBeta(
this.config.http,
cagesAttestationData
);
if (attest.hasAttestationBindings()) {
await attest.trustCagesRootCA(this.http);
attest.addAttestationListenerBeta(this.config.http, cagesAttestationData);
} else {

@@ -101,4 +105,7 @@ console.error(

/**
* @deprecated use enableEnclaves instead
*/
async enableCages(cagesAttestationData) {
if (cageAttest.hasAttestationBindings()) {
if (attest.hasAttestationBindings()) {
//Store attestation documents from cages in cache

@@ -115,13 +122,10 @@ let attestationCache = new AttestationDoc(

//Store client PCR providers to periodically pull new PCRs
const cagePcrManager = new CagePcrManager(
this.config,
cagesAttestationData
);
const pcrManager = new PcrManager(this.config, cagesAttestationData);
await cagePcrManager.init();
await pcrManager.init();
cageAttest.addAttestationListener(
attest.addAttestationListener(
this.config.http,
attestationCache,
cagePcrManager
pcrManager
);

@@ -135,2 +139,37 @@ } else {

/**
* @param {{ [key: string]: PCRs | PCRs[] | (() => Promise<PCRs | PCRs[]>) }} attestationData
* @throws {import('./utils/errors').MalformedAttestationData}
*/
async enableEnclaves(attestationData) {
attest.validateAttestationData(attestationData);
if (attest.hasAttestationBindings()) {
//Store attestation documents in cache
let attestationCache = new AttestationDoc(
this.config.http,
this.http,
Object.keys(attestationData),
this.appId,
this.config.http.enclavesHostname
);
await attestationCache.init();
//Store client PCR providers to periodically pull new PCRs
const pcrManager = new PcrManager(Config, attestationData);
await pcrManager.init();
attest.addAttestationListener(
this.config.http,
attestationCache,
pcrManager
);
} else {
console.error(
'EVERVAULT ERROR :: Cannot enable Enclaves without installing the Evervault attestation bindings'
);
}
}
async generateNonce() {

@@ -137,0 +176,0 @@ const nonce = await this.crypto.generateBytes(16);

@@ -28,2 +28,8 @@ class EvervaultError extends Error {

class MalformedAttestationData extends EvervaultError {
constructor(message) {
super(`Malformed attestation data provided - ${message}`);
}
}
class ExceededMaxFileSizeError extends EvervaultError {}

@@ -86,2 +92,3 @@

FunctionRuntimeError,
MalformedAttestationData,
};

@@ -9,3 +9,3 @@ module.exports = {

httpsHelper: require('./httpsHelper'),
cageAttest: require('./cageAttest'),
attest: require('./attest'),
};
{
"name": "@evervault/sdk",
"version": "5.0.0",
"version": "5.1.0",
"description": "Node.js SDK for Evervault",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc