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 🙏

© 2024 – Pkg Stats / Ryan Hefner

locksmart-api

v2.0.0

Published

API client for the Dog & Bone LockSmart service

Downloads

7

Readme

locksmart-api

API client for the Dog & Bone LockSmart service

npm version code climate js-semistandard-style

Background

Dog & Bone sell a set of Bluetooth LE-enabled padlocks that can be opened with their "LockSmart" app. The app stores and retrieves lock information via an HTTP API, including a random per-lock "password" used for unlocking. This package implements a client for that API.

At the moment this only implements logging in and pulling lock information, as that's all I've needed personally. Adding support for additional endpoints should be pretty simple, and descriptions of all known endpoints can be found in the RESEARCH file. Pull requests very welcome!

Install

npm install --save locksmart-api

Example

const { LockSmartApiClient } = require('locksmart-api');
const co = require('co');

co(function * () {
  const client = new LockSmartApiClient();

  const userData = yield client.login('[email protected]', 'password123');
  console.log('user data:', userData);
  /* user data: { email: '[email protected]',
       apn_token: null,
       android_token: null,
       register_source: 'default',
       crowd_sourced_locations: false,
       notify_shared_lock_status: false,
       first: 'Jane',
       last: 'Doe',
       mobile: '1234567890',
       id: 'ffffffffffffffffffffffff',
       facebook_id: null,
       opt_out: true,
       is_deleted: false } */

  const lockInfo = yield client.getLocks();
  console.log('lock info:', lockInfo);
  /* lock info: { locks: 
        [ { name: 'My Padlock',
            serial: 'FFFFFFFFFFFF',
            photo_url: null,
            access: 'tap',
            push_unlock_enabled: false,
            found_notification_requested: false,
            location_enabled: false,
            tracking_enabled: false,
            power_save: false,
            notify_battery: true,
            notify_invite_accepted: true,
            notify_share_unlock: true,
            password: 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
            passcode: '',
            shared_users: [],
            location: [Object] } ],
       latest_firmware: 
        { id: '57847553a3ec34c9258b4c41',
          version: 'V2.31',
          channel: 2,
          sha1_checksum: '178e7f8303e1aa1617deb63d3d4e7623191c7511',
          public_notes: 'Support for Push-to-Unlock (on Lock hardware that supports it) and Location Services features',
          release_time: 1468298579,
          url: 'https://97fd82753dda7729ce31-e3895cffa4c5dde4cf6f6a3c268ece7b.ssl.cf4.rackcdn.com/V2.315784755363645.hex',
          supported_upgrade_from: 
           [ 'V2.31',
             'V2.30',
             'V2.29',
             'V2.27',
             'V2.25',
             'V2.24',
             'V2.23',
             'V2.28',
             'V2.20',
             'V2.1' ] },
       shared_locks: [] } */
}).catch(err => console.error(err.stack));

Documentation

LockSmartApiClient(apiKey = LOCKSMART_API_DEFAULT_KEY)

API client constructor. Optionally takes an API key; default is the key the Android app uses.

LockSmartApiClient#login(email, password)

Logs into the LockSmart API service. Returns a promise with users data from the API response. Call this before using other API methods.

LockSmartApiClient#getLocks()

Pulls lock information from the LockSmart API server. Returns a promise.

LockSmartApiClient#apiKey

The API key used to authenticate with the LockSmart API server.

LockSmartApiClient#token

The user session token used to authenticate with the LockSmart API server. Present after logging in. It is unknown whether or not this expires.

Constants

In addition to LockSmartApiClient, thhe following constants are exposed from the locksmart-api module:

  • LOCKSMART_API_DEFAULT_KEY
  • LOCKSMART_API_BASE_URI
  • LOCKSMART_API_LOGIN_ENDPOINT
  • LOCKSMART_API_GET_LOCKS_ENDPOINT

Development

$ npm lint # checks code style and license compatibility
$ npm test # simple test script (requires a LockSmart account)

License

BSD3