1.0.0 • Published 8 years ago

@kaltiot/ks-secret-api v1.0.0

Weekly downloads
2
License
MIT
Repository
-
Last release
8 years ago

ks-secret-api

Helper library for fetching a secret for a username.

API

secret.fetch(opts , callback)

Fetch a secret for a username. Provide a callback function if you want to use that. Or use the returned promise.

opts can have the following fields:

FieldTypeDescription
addressstring(optional) Server address.
sessionIdstring(required) Session ID.
usernamestring(required) The username to fetch the secret for.

Usage

node.js

var secret = require("@kaltiot/ks-secret-api");

secret.fetch({ ... }).then(function (secret) {
  // do something
}):;

Browser

There's a pre-compiled file for the browser in dist/secret.js. Include it and window.KSSecretAPI will be set.

<!DOCTYPE html>
<html>
<head>
  <title>secret fetch</title>
</head>
<body>
  <script type="text/javascript" src="/dist/secret.js"></script>
  <script type="text/javascript">
    var secret = window.KSSecretAPI;

    secret.fetch({ ... }).then(function (secret) {
      // do something
    });
  </script>
</body>
</html>