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

armlet

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

armlet - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

6

index.js

@@ -24,7 +24,7 @@ const url = require('url')

requester.do(bytecode, apiKey, apiUrl)
.then((uuid) => {
.then(uuid => {
return poller.do(uuid, apiKey, apiUrl)
}).then((issues) => {
}).then(issues => {
resolve(issues)
}).catch((err) => {
}).catch(err => {
reject(err)

@@ -31,0 +31,0 @@ })

@@ -1,4 +0,2 @@

const url = require('url')
exports.do = (uuid, apiKey, apiUrl = url.parse('https://api.mythril.ai'), pollStep = 1000) => {
exports.do = (uuid, apiKey, apiUrl, pollStep = 1000) => {
return new Promise((resolve, reject) => {

@@ -18,3 +16,3 @@ const lib = apiUrl.protocol === 'http:' ? require('http') : require('https')

getOptions,
(res) => {
res => {
if (res.statusCode === 401) {

@@ -30,3 +28,3 @@ clearInterval(intervalID)

let rawData = ''
res.on('data', (chunk) => { rawData += chunk })
res.on('data', chunk => { rawData += chunk })
res.on('end', () => {

@@ -33,0 +31,0 @@ let data = ''

@@ -1,6 +0,4 @@

const url = require('url')
const basePath = '/mythril/v1/analysis'
exports.do = (bytecode, apiKey, apiUrl = url.parse('https://api.mythril.ai')) => {
exports.do = (bytecode, apiKey, apiUrl) => {
return new Promise((resolve, reject) => {

@@ -32,3 +30,3 @@ const lib = apiUrl.protocol === 'http:' ? require('http') : require('https')

[500, 'received error from API server']])
const postRequest = lib.request(postOptions, (res) => {
const postRequest = lib.request(postOptions, res => {
if (res.statusCode < 200 || res.statusCode > 299) {

@@ -40,3 +38,3 @@ reject(new Error(`Failed to get response, status code ${res.statusCode}: ${errMap.get(res.statusCode)}`))

let rawData = ''
res.on('data', (chunk) => { rawData += chunk })
res.on('data', chunk => { rawData += chunk })
res.on('end', () => {

@@ -53,3 +51,3 @@ let data = ''

postRequest.on('error', (err) => {
postRequest.on('error', err => {
if (err.errno === 'ENOTFOUND') {

@@ -56,0 +54,0 @@ reject(new Error(`Could not connect to API server at ${apiUrl.href}`))

{
"name": "armlet",
"version": "0.1.2",
"version": "0.1.3",
"description": "A Mythril Platform API client.",

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

@@ -22,5 +22,5 @@ [![CircleCI](https://circleci.com/gh/fgimenez/armlet.svg?style=svg&circle-token=3794de647a820eabf62e091c80d761a722b17b0c)](https://circleci.com/gh/fgimenez/armlet)

analyze(myBytecode, myApiKey)
.then((issues) => {
.then(issues => {
console.log(issues)
}).catch((err) => {
}).catch(err => {
console.log(err)

@@ -27,0 +27,0 @@ })

@@ -50,3 +50,3 @@ const nock = require('nock')

await poller.do(uuid, validApiKey, undefined, 10).should.eventually.deep.equal(emptyResult)
await poller.do(uuid, validApiKey, defaultApiUrl, 10).should.eventually.deep.equal(emptyResult)
})

@@ -75,3 +75,3 @@

await poller.do(uuid, validApiKey, undefined, 10).should.eventually.deep.equal(expectedIssues)
await poller.do(uuid, validApiKey, defaultApiUrl, 10).should.eventually.deep.equal(expectedIssues)
})

@@ -112,3 +112,3 @@

await poller.do(uuid, validApiKey, undefined, 10).should.be.rejectedWith(Error)
await poller.do(uuid, validApiKey, defaultApiUrl, 10).should.be.rejectedWith(Error)
})

@@ -127,3 +127,3 @@

await poller.do(uuid, inValidApiKey, undefined, 10).should.be.rejectedWith(Error)
await poller.do(uuid, inValidApiKey, defaultApiUrl, 10).should.be.rejectedWith(Error)
})

@@ -152,5 +152,5 @@

await poller.do(uuid, validApiKey, undefined, 10).should.be.rejectedWith(SyntaxError)
await poller.do(uuid, validApiKey, defaultApiUrl, 10).should.be.rejectedWith(SyntaxError)
})
})
})

@@ -11,3 +11,3 @@ const nock = require('nock')

describe('#do', () => {
const defaultApiUrl = 'https://api.mythril.ai'
const defaultApiUrl = url.parse('https://api.mythril.ai')
const httpApiUrl = url.parse('http://localhost:3100')

@@ -57,3 +57,3 @@ const httpsApiUrl = url.parse('https://localhost:3100')

it('should default to official API endpoint', async () => {
nock(defaultApiUrl, {
nock(defaultApiUrl.href, {
reqheaders: {

@@ -72,3 +72,3 @@ authorization: `Bearer ${validApiKey}`

await requester.do(bytecode, validApiKey).should.eventually.equal(uuid)
await requester.do(bytecode, validApiKey, defaultApiUrl).should.eventually.equal(uuid)
})

@@ -151,3 +151,3 @@

it('should reject on non-JSON data', async () => {
nock(defaultApiUrl, {
nock(defaultApiUrl.href, {
reqheaders: {

@@ -163,5 +163,5 @@ authorization: `Bearer ${validApiKey}`

await requester.do(bytecode, validApiKey).should.be.rejectedWith(SyntaxError)
await requester.do(bytecode, validApiKey, defaultApiUrl).should.be.rejectedWith(SyntaxError)
})
})
})
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