Module: miot/service/security

安全相关服务

Example
import {Service} from 'miot'

Service.security.shareSecureKey(deviceID, shareUid, {})
 .then(secureKey=>{
    ...
 })

Service.security.loadSecureKeys(deviceID).then(secureKeys=>{
   if(secureKeys.length > 0){
      const key = secureKeys[0];
      key.status = 1;
      key.save().then(key=>{...})
   }
})

Interfaces

ISecureKey

Methods

(static) getLockBindInfo(deviceID) → {Promise.<json>}

获取锁绑定信息, /device/blelockbindinfo 返回数据格式:{"bindtime":1505180216}

Parameters:
Name Type Description
deviceID *
Returns:
Type
Promise.<json>

(static) loadSecureKeys(deviceID) → {Promise.<Array.<ISecureKey>>}

加载设备的安全锁 /share/bluetoothkeyshare

Parameters:
Name Type Description
deviceID *

设备ID

Returns:
Type
Promise.<Array.<ISecureKey>>

(static) shareSecureKey(deviceID, shareUid, settingsopt) → {Promise.<ISecureKey>}

分享蓝牙锁的钥匙 /share/bluetoothkeyshare 锁固件版本在 2.0.0 及以上, 不支持钥匙的分享

Parameters:
Name Type Attributes Default Description
deviceID

被分享设备ID

shareUid

被分享人

settings Object <optional>
{}

readonly = true, 则被分享人不可接收锁push,false则被分享人可接收锁push,(family关系用户不受这个字段影响)。status:分享类别,1:暂时,2:周期,3:永久; weekdays 生效日期(星期几,例如周一和周三对应1和3,[1, 3]),仅在status=2时不可为空

Returns:
Type
Promise.<ISecureKey>