🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

@tempicolabs/sdk

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@tempicolabs/sdk

Javascript SDK for TempicoLabs API

4.5.0
unpublished
latest
Version published
Weekly downloads
0
Maintainers
2
Weekly downloads
 
Created

TempicoLabs

Tempico Labs SDK

Tempico Labs SDK for API. For node.js and the web.


It is the SDK for Tempico Labs API using in node.js and the browser. It is written in clean ES6 Javascript. You can try SDK in the browser or on RunKit. If you need CLI it's here (@tempicolabs/cli)

SDK Features:

  • Me - Returns an information about IP you are connecting from
  • IP - Get information about IP address including organisation, GeoData & other
  • Hash - Returns an information about particular sha256 or md5 hash you are interested in.
  • DNS - Get IPv4/IPv6 addresses using domain name
  • Port Scan - Scan ports of a given host
  • Email Leaks - Returns an information about known account compromises linked to provided email

Install

To install TmLabs for use in node or the browser with require('@tempicolabs/sdk'), run:

npm i @tempicolabs/sdk --save

Or alternatively using Yarn, run:

yarn add @tempicolabs/sdk

SDK contain:

dist/tmlabs.umd.js - Standard UMD package for node.js

dist/tmlabs.es.js - ES6 Package for node.js using import

dist/tmlabs.js - Unminified browser version

dist/tmlabs.min.js - Minified browser version

src/* - Sources. Javascript ES2016

Tempico Labs API Documentation

Read SDK Documentation.

Read the full API Documentation.

Usage

Try SDK in browser or on RunKit.

SDK contain these methods:

  • ip
  • hash
  • scan
  • dns
  • me
  • email/leaks
  • account/status
  • status
const answer = await new TmLabs.fetch('[method_name]', {params})

Read Usage Guide

Examples

It is a wrapper for API. It uses fetch-ponyfill for HTTP requests and create-hash for hashing.

In the browser

<script src="https://cdn.jsdelivr.net/npm/@tempicolabs/sdk@latest/dist/tmlabs.min.js"></script>
<script>
    var TmLabs = new TmLabs.default(); // or new TmLabs.TmLabs()
    TmLabs.on('error', function(error, command){
      console.error('[ SDK ERROR ]', error);
    });
    TmLabs.on('response', function(command, response){
      console.info('response', response);
      console.log('balanceRemaining', command.balanceRemaining); // return Remaining Balance
    });
    TmLabs.on('command', function(args, command){ // on command start 
      console.log('command', command)
    });
    TmLabs.fetch('dns', {
      domain: 'google.com'
    }).then(function(answer){
      var ips = answer.content[Object.keys(answer.content)[0]];// because response will be in 'google.com' key
      console.log('Google.com IPs', ips) // get array of one completed command
      return TmLabs.fetch('ip', {
        ip: ips[0]
      })
    }).then(function(answer){
      console.info('google ip info', answer.content) // get info about google ip address
      console.log('History after IP command', TmLabs.history) // get array of two completed commands
    });
    console.log('History with pending requests', TmLabs.history) // get array of two pending commands
</script>

In Node.js

SDK also works in node.js, using the same npm package!

  var TmLabs = require('@tempicolabs/sdk').default
  
  TmLabs.on('error', function (error, command) {
    console.error(error);
  });
  TmLabs.on('response', function (response, command) {
    console.log('response', response);
    console.log('balanceRemaining', command.balanceRemaining); // return Remaining Balance
  });
  TmLabs.fetch('dns', {
    domain: 'google.com'
  }).then(function (response) {
    console.log('after then response', response)
  })

** You can use bundled version dist/tmlabs.umd.js

Package also contain FetchCommand Class for customizing fetch data from API. For example in ES6:

  import { FetchCommand } from '@tempicolabs/sdk'
  
  (async function() {
    
    const command = new FetchCommand({
      method: 'ip'
    })
    command.on('error', (error, command) => {
      console.error(error);
    });
    command.on('response', (response, command) => {
      console.log('response object', response);
      console.log('response code', command.status); // same as response.status. return status code, for example 200
    });
    const response = await command.run({ // this response also goes to command.on('response') EventHandler if no error exists
      ipaddr: '173.194.122.233' // google ip address. using alias(ipaddr)
    })
    console.log(response) // API response. same as command.content
    
  })();

** You can use bundled version in dist/tmlabs.es.js for ES6

More examples you can find here

License

MIT. Copyright (c) Maxim Maximov and Tempico Labs, LLC.

FAQs

Package last updated on 04 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts