0.2.0 • Published 5 years ago

frtz-core v0.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Usage

const { auth, network } = require("frtz")

!(async () => {
  const { SID } = await auth.login({ password: "mypassword" })
  const { passive } = await network.getDevices({ SID })

  const woke = await network.wake({ UID: passive[0], SID })
})()

Functions

Typedefs

frtz.auth.getNewSession(options) ⇒ Promise.<Session>

get a new challenge token

Kind: global function

ParamType
optionsObject
options.hoststring

frtz.auth.getLoginToken(options) ⇒ string

get a login token (challenge + password)

Kind: global function
Returns: string - solved challenge

ParamType
optionsObject
options.passwordstring
option.challengestring

frtz.auth.getSession(options) ⇒ Promise.<Session>

get session with username and loginToken, expires in 20 minutes unless used

Kind: global function

ParamType
optionsObject
options.loginTokenstring
options.hoststring
options.usernamestring

frtz.auth.checkAuth(options) ⇒ Promise.<boolean>

this makes a request to the region & language page, which seems to be the fastest in terms of response time (~650ms)

Kind: global function

ParamTypeDefault
optionsObject
options.SIDstring
options.hoststring"https://fritz.box"

frtz.auth.login(options) ⇒ Promise.<session>

Takes password and optionally username and host and returns a logged in session object

Kind: global function
Returns: Promise.<session> - session object

ParamTypeDefault
optionsobject
options.passwordstring
options.usernamestring
options.hoststring"https://fritz.box"

frtz.network.getDevices(options) ⇒ Promise.<Object>

Get a list of devices

Kind: global function
Returns: Promise.<Object> - data object containing both online and offline devices

ParamTypeDefaultDescription
optionsObject
options.SIDstringsession ID
options.hoststring"https://fritz.box"

frtz.network.wake(options) ⇒ Promise.<boolean>

Wake a device from sleep (Wake On Lan)

Kind: global function

ParamTypeDefaultDescription
optionsObject
options.SIDstringsession ID
options.UIDstringunit ID (device ID)
options.hoststring"https://fritz.box"

Session : Object

A session object

Kind: global typedef
Properties

NameType
SIDstring
Challengestring
BlockTimestring
expiresnumber
RightsObject
Rights.NameArray.<string>
Rights.AccessArray.<string>
0.2.0

5 years ago

0.1.0

5 years ago

0.0.0

5 years ago