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

mist-api

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mist-api - npm Package Compare versions

Comparing version 0.0.13 to 0.0.15

35

index.js

@@ -75,13 +75,13 @@

//console.log("the answer is:", inspect(msg, { colors: true, depth: 10 }));
//console.log("the answer is:", require('util').inspect(msg, { colors: true, depth: 10 }));
if(typeof self.sandbox.requests[id] === 'function') {
if(typeof self.requests[id] === 'function') {
if (msg.err) {
self.sandbox.requests[id](true, { code: msg.code, msg: msg.msg });
self.requests[id](true, { code: msg.code, msg: msg.msg });
} else {
self.sandbox.requests[id](null, msg.data);
self.requests[id](null, msg.data);
}
if(!msg.sig) {
delete self.sandbox.requests[id];
delete self.requests[id];
}

@@ -200,8 +200,15 @@ }

function Sandboxed(mist) {
function Sandboxed(mist, sandboxId) {
if (!mist || !mist.opts || !mist.opts.type === 2) {
throw new Error('Sandbox constructor parameter must be Mist of type 2.');
throw new Error('Sandbox constructor parameter 1 must be Mist of type 2.');
}
this.requests = {};
if ( !Buffer.isBuffer(sandboxId) || sandboxId.length !== 32 ) {
console.log("sandboxId:", sandboxId);
throw new Error('Sandbox constructor parameter 2 must be Buffer(len:32).');
}
this.api = mist.api;
this.sandboxId = sandboxId;
this.mist = mist;
mist.registerSandbox(this);

@@ -212,6 +219,7 @@ }

var id = ++sharedId;
var request = { op: op, args: args, id: id };
var sandboxArgs = [this.sandboxId].concat(args);
var request = { op: 'sandboxed.'+op, args: sandboxArgs, id: id };
// store callback for response
this.requests[id] = cb;
// store callback for response in the mist object
this.mist.requests[id] = cb;

@@ -224,4 +232,7 @@ this.api.sendToAddon('sandboxed', 1, BSON.serialize(request));

Sandboxed.prototype.requestCancel = function(id) {
var request = { cancel: id };
var self = this;
var request = { cancel: id, sandbox: this.sandboxId };
setTimeout(function() { if(self.mist.requests[id]) { delete self.mist.requests[id]; } }, 500);
this.api.sendToAddon('sandboxed', 1, BSON.serialize(request));

@@ -228,0 +239,0 @@ };

{
"name": "mist-api",
"version": "0.0.13",
"version": "0.0.15",
"description": "Mist API wrapper for node. Used for accessing all Mist APIs.",

@@ -24,4 +24,4 @@ "main": "index.js",

"devDependencies": {
"mocha": "3.1.2"
"mocha": "3.2.0"
}
}

@@ -50,6 +50,4 @@ # Mist API

}
}
};
;
// callback for write commands sent to this device

@@ -56,0 +54,0 @@ mist.write(function(endpoint, value) {

Sorry, the diff of this file is not supported yet

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