mm-services-devices

Device Manager for MicroMinion platform


Keywords
devices, sync, microminion
License
MIT
Install
npm install mm-services-devices@0.0.6

Documentation

mm-services-devices

Device Manager for MicroMinion platform

CircleCI

Initialization

var MicroMinionPlatform = require('mm-platform')
var DeviceManager = require('mm-services-devices')
var MemStore = require('kad-memstore')

var platform = new MicroMinionPlatform()

var devices = new DeviceManager({
  platform: platform,
  storage: new MemStore(),
  logger: platform._log
})

Function calls

devices.addKey(publicKey, dontSave)

Adds a third-party key that is trusted to database. dontSave is boolean to determine whether or not to save devices list to storage.

devices.createTenant(publicKey, secret)

Calls the tenant service on publicKey and provides secret in order to create a new tenant

devices.getDevices()

Returns an array with all trusted publicKeys

Messaging API

Data structures

The data structure maintained is an array of trusted public keys

Published messages

tenant.create

See Tenant Service README

devices.update

Published locally. Contains list of trusted devices.

Subscribed messages

public.tenant.createReply

See Tenant Service README