npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

plugair-sdk

v1.0.2

Published

PlugAir SDK for Node.js

Downloads

12

Readme

PlugAir SDK for Node.js

npm version

Installation

npm install plugair-sdk

Credentials from Environment Variables

export PLUGAIR_API_KEY=0123456789012345678901234567890123456789
export PLUGAIR_SHARED_SECRET=abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl

Usage

var PlugAir = require('plugair-sdk');
var pa = new PlugAir();

pa.generateChallenge()
  .then((challenge)=>{
    console.log('challenge', challenge);
    // challenge 5ACB6CFB04DCFADC481E193F427FF477D5D74807317014F0B7668C495214D1F4
  })
  .catch((error)=>{
    console.log('error', error);
  })
;

pa.verify(
  'pKjZIfryjyhGskAJPAnj9XoQy2q1vOOywLY9XiH5',
  'XFFEaiyk3SCVfGCfI1ZxzhDqZcd96O95zKrG+5NCy1ib5wiNTtHKutVb4AL94HyCjOYDnt9QeSnqUtUJGJ8RG9DmqLl6vpG8imIyzFBsVGRUaF/lSpoRumFWj4uNGKgKWgRbNaCtBefJBkuToPctD4xqPDjI0/a1KAQDYTIyqhvrJcJIN8EXbB0EGxYyLlhmJJBTNMXf1bdvNINCi756xi5RusYj3Ismpo1NV7cDQ37Uy3W21lhKwCJXjlvr2jK7QPton0NxftCWjaeIwTHw/f61CzI4JHaGLft1KrZqCBptCs2fRpf7De3VL/mCaAKeoGAIERbtYfAeB3bOXpRA2A==',
  'hI3wSJ3mkypCJH8doXx6wcStkvNwslYGlZ1tbRjNFGSoYfWT3tgE/3N8f7hLZyHA9XD/aLaJtW3py9DamGw7dcjsEZSHrQ+xKee+q6ExM3vLUu/98YHPDjExCXzVeYwmKz7xN88FWVEuSEiMA/d1xC/pyjJUs10bMH/ITs3UkrydI9MynuNH3C+TrnD2FnNkkcAvJRrsYMhxPcjLLIcBbEGuEIAtHoK8X10fXtrGEjr7eztht2lkaFfRSkdPUa/lCrHb+t3M9iX/6hd9HiY//BmOS0CTw07GiPjFM/WKc8OOieax1XQMKJ/J5g9WxMAJktVeCMOXNze4tdNtOgZh4DegFsrCp2Y3evnF12MXD+qM2vozFL4lDc8HygNIIx4t3L43c5hEDGHk0Nb/KcL+58RKqKovVHez1VOsfnC14jTOAqZlkRDXb6Fs3SOfsh8ogg+oqU56EWPwXAqC6Jy/ZQ=='
  )
  .then((result)=>{
    console.log('verify result', result);
    // verify result { serialNumber: '0124000000006B66EE', authResult: 'OK' }
    
    if(result.authResult == PlugAir.AUTH_RESULT_OK){
      console.log('### Auth OK');
    }
  })
  .catch((error)=>{
    console.log('error', error);
  })
;

API Documents

Initialize

let plugAir = new PlugAir(apiKey, sharedSecret)
  • Parameters
    • apiKey String - Hard coded API key (optional)
    • sharedSecret String - Hard coded shared secret (optional)
  • Response
    • PlugAir object

Generate challenge

plugAir.generateChallenge(callback)
  • Parameters
    • callback Function - Callback function (optional)
      • Parameters
        • error Error - Error object
        • challenge String - 32 Bytes challenge in Hex
  • Response
    • Promise object

Verfiy

plugAir.verify(credentialKey, authKey, authData, callback)
  • Parameters
    • credentialKey String - Client credential key from smartphone
    • authKey String - Client authentication key from smartphone
    • authData String - Client authentication data from smartphone
    • callback Function - Callback function (optional)
      • Parameters
        • error Error - Error object
          • status String - Status code
          • reason String - Error reason
          • message String - Detail error message
        • result Object - Authentication result
          • authResult String - 'OK', 'NG', 'OTHER_APP_PLUG'
          • serialNumber String - 9 Bytes serialNumber in Hex
          • apps Array - store correct iOS/Android app info when authResult is 'OTHER_APP_PLUG'
  • Response
    • Promise object

Error reasons

| Reason | |:-----------------------------------------| | SERVER_API_KEY_AUTHENTICATION_ERROR | | CLIENT_CREDENTIAL_AUTHENTICATION_ERROR | | INVALID_CHALLENGE | | PLUGAIR_AUTHENTICATION_ERROR | | PLUGAIR_NOT_FOUND | | INTERNAL_SERVER_ERROR |

License

Apache 2.0