locksmart-api
API client for the Dog & Bone LockSmart service
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 = ;const co = ; ;
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)