Socket
Socket
Sign inDemoInstall

@zondax/zemu

Package Overview
Dependencies
Maintainers
1
Versions
166
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zondax/zemu - npm Package Compare versions

Comparing version 0.11.0 to 0.11.1

.github/workflows/main.yml

45

dist/index.js

@@ -32,2 +32,4 @@ "use strict";

var _elfy = _interopRequireDefault(require("elfy"));
/** ******************************************************************************

@@ -129,2 +131,4 @@ * (c) 2020 Zondax GmbH

var options,
elfApp,
elfInfo,
_args = arguments;

@@ -145,7 +149,34 @@ return _regenerator["default"].wrap(function _callee$(_context) {

_context.next = 5;
elfApp = _fsExtra["default"].readFileSync(this.elfPath);
elfInfo = _elfy["default"].parse(elfApp);
if (!(elfInfo.entry != parseInt("0xc0d00001") && elfInfo.entry != parseInt(" 0xc0de0001"))) {
_context.next = 7;
break;
}
throw new Error("Are you sure is a Nano S/X app ?");
case 7:
if (!(this.model == 'nanos' && elfInfo.entry != parseInt("0xc0d00001"))) {
_context.next = 9;
break;
}
throw new Error("Zemu model is set to 'nanos' but elf file doesn't seem to be nano s build. Did you pass the right elf ?");
case 9:
if (!(this.model == 'nanox' && elfInfo.entry != parseInt("0xc0de0001"))) {
_context.next = 11;
break;
}
throw new Error("Zemu model is set to 'nanox' but elf file doesn't seem to be nano x build. Did you pass the right elf ?");
case 11:
_context.next = 13;
return this.emuContainer.runContainer(options);
case 5:
_context.next = 7;
case 13:
_context.next = 15;
return this.connect()["catch"](function (error) {

@@ -157,10 +188,10 @@ console.log(error);

case 7:
_context.next = 9;
case 15:
_context.next = 17;
return this.snapshot();
case 9:
case 17:
this.mainMenuSnapshot = _context.sent;
case 10:
case 18:
case "end":

@@ -167,0 +198,0 @@ return _context.stop();

5

package.json
{
"name": "@zondax/zemu",
"version": "0.11.0",
"version": "0.11.1",
"description": "Zemu Testing Framework",

@@ -30,2 +30,3 @@ "main": "./dist/index.js",

"dockerode": "^3.2.0",
"elfy": "^1.0.0",
"fs-extra": "^9.0.1",

@@ -60,3 +61,3 @@ "json-rpc2": "^2.0.0",

"build": "babel src --copy-files --out-dir dist",
"test:unit": "jest -c jest.config.unit.js --detectOpenHandles",
"test:unit": "jest -c jest.config.unit.js --detectOpenHandles --runInBand",
"docs:build": "vuepress build docs"

@@ -63,0 +64,0 @@ },

@@ -23,2 +23,3 @@ /** ******************************************************************************

import GRPCRouter from "./grpc";
import elfy from "elfy";

@@ -155,2 +156,17 @@ const rndstr = require("randomstring");

let elfApp = fs.readFileSync(this.elfPath);
let elfInfo = elfy.parse(elfApp);
if (elfInfo.entry != parseInt("0xc0d00001") && elfInfo.entry != parseInt(" 0xc0de0001")) {
throw new Error("Are you sure is a Nano S/X app ?");
}
if (this.model == 'nanos' && elfInfo.entry != parseInt("0xc0d00001")) {
throw new Error("Zemu model is set to 'nanos' but elf file doesn't seem to be nano s build. Did you pass the right elf ?");
}
if (this.model == 'nanox' && elfInfo.entry != parseInt("0xc0de0001")) {
throw new Error("Zemu model is set to 'nanox' but elf file doesn't seem to be nano x build. Did you pass the right elf ?");
}
await this.emuContainer.runContainer(options);

@@ -157,0 +173,0 @@ // eslint-disable-next-line func-names

@@ -22,3 +22,3 @@ /** ******************************************************************************

jest.setTimeout(10000);
jest.setTimeout(15000);
const DEMO_APP_PATH_S = Resolve("bin/demoAppS.elf");

@@ -32,3 +32,3 @@ const DEMO_APP_PATH_X = Resolve("bin/demoAppX.elf");

custom: `-s "${APP_SEED}" `,
X11: true,
X11: false,
};

@@ -70,2 +70,14 @@

test("Trying to run in nano S mode with a nano X elf", async () => {
const sim = new Zemu(DEMO_APP_PATH_S);
expect(sim).not.toBeNull();
try {
await sim.start(ZEMU_OPTIONS_X);
} catch(err) {
expect(err).toEqual(new Error("Zemu model is set to 'nanox' but elf file doesn't seem to be nano x build. Did you pass the right elf ?"));
} finally {
await sim.close();
}
});
test("Snapshot", async () => {

@@ -196,2 +208,2 @@ const sim = new Zemu(DEMO_APP_PATH_S);

}
});
});
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