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 3.1.1 to 3.2.0

lib/utils/validationHelper.js

14

lib/core/http.js

@@ -77,3 +77,15 @@ const { errors } = require('../utils');

return { getCageKey, runCage, getCert };
const createRunToken = (cageName, payload) => {
return post(
`v2/functions/${cageName}/run-token`,
{
...payload,
},
{
'Content-Type': 'application/json',
}
);
};
return { getCageKey, runCage, getCert, createRunToken };
};

38

lib/index.js

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

certHelper,
validationHelper,
} = require('./utils');

@@ -306,14 +307,5 @@ const Config = require('./config');

async run(cageName, payload, options = {}) {
if (!Datatypes.isObjectStrict(payload)) {
throw new errors.EvervaultError('Cages must be given an object to run');
}
if (!Datatypes.isString(cageName))
throw new errors.EvervaultError('Cage name invalid');
if (
Datatypes.isObjectStrict(options) &&
Datatypes.isDefined(options.version) &&
!Datatypes.isNumber(options.version)
) {
throw new errors.EvervaultError('Cage version must be a number');
}
validationHelper.validatePayload(payload);
validationHelper.validateCageName(cageName);
validationHelper.validateOptions(options);

@@ -402,8 +394,5 @@ if (this.retry) {

async encryptAndRun(cageName, data, options) {
if (!Datatypes.isString(cageName)) {
throw new errors.EvervaultError('Cage name invalid');
}
if (!Datatypes.isObjectStrict(data)) {
throw new errors.EvervaultError('Cages must be given an object to run');
}
validationHelper.validatePayload(data);
validationHelper.validateCageName(cageName);
validationHelper.validateOptions(options);

@@ -415,2 +404,15 @@ const payload = await this.encrypt(data);

/**
* @param {String} cageName
* @param {Object} payload
* @returns {Promise<*>}
*/
async createRunToken(cageName, payload) {
validationHelper.validatePayload(payload);
validationHelper.validateCageName(cageName);
const response = await this.http.createRunToken(cageName, payload);
return response.body;
}
defineHiddenProperty(property, value) {

@@ -417,0 +419,0 @@ Object.defineProperty(this, property, {

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

certHelper: require('./certHelper'),
validationHelper: require('./validationHelper'),
};
{
"name": "@evervault/sdk",
"version": "3.1.1",
"version": "3.2.0",
"description": "Node.js SDK for Evervault",

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

@@ -93,2 +93,15 @@ [![Evervault](https://evervault.com/evervault.svg)](https://evervault.com/)

### evervault.createRunToken()
`evervault.createRunToken()` creates a single use, time bound token for invoking a cage.
```javascript
async evervault.createRunToken(cageName: String, payload: Object);
```
| Parameter | Type | Description |
| --------- | ------ | ---------------------------------------------------- |
| cageName | String | Name of the Cage the run token should be created for |
| data | Object | Payload that the token can be used with |
## Contributing

@@ -95,0 +108,0 @@

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