Skip to content

Client‑Server API

Daniel Huigens edited this page Jan 17, 2015 · 2 revisions

Instead of interfacing with airborn-server directly, most of which is undocumented, we recommend you to include and interface with airborn-server/login.js and airborn/core.js.

Note: please email us with questions about licensing and trademarks. We haven't made up our minds yet.

login.js

This files and its API is unstable, although it won't change often as per HCS. Update it often. It defines the following function:

login()

login(creds, firstfile, requestmorecreds(type, data, callback(creds)), success(storecreds), error({status, statusText, id}))

  • creds is an object. Warning: this object will be mutated by the function.

    The first time logging in, creds has two required properties, creds.username and creds.password.

    The next time logging in, you should pass storecreds (see below).

  • firstfile is the first file, which login() will download and eval(). You can pass any file, but these are logical choices:

    • "/Core/core.js" provides an API for reading and writing files (see below).

    • "/Core/init.js" also loads core.js but also startup.js, which loads the window manager and generally starts up Airborn.

  • requestmorecreds is a function for multi-factor authentication. Currently, this function is never called, but it might be in the future. You should pass {} to callback, which will result in an error (see below).

  • success(storecreds) is a function called on success. It is passed the following arguments:

    • storecreds is an object which you can pass to login() next time to speed up logging in.

      • Note: if you serialize this as JSON, you're good.
  • error({status, statusText, id})) is a function called on errors. It is passed an object with the following properties:

    • status and statusText are unstable.

    • id is one of the following strings:

      • "wronguser"

      • "wrongpass"

      • "missingcreds", if you didn't pass enough credentials to login().

      • "missingmorecreds", if you didn't pass enough credentials to the callback of requestmorecreds.

      • "error" for any other error

core.js

The API defined in this file is part of the Internal API. Please only use the functions described on that page.