open-index/open-npm huggingface dataset:
npm package: @onekeyfe/link
Description: OneKey Link for browser
Author: OneKey
Latest version: 1.7.6

# @onekeyhq/link

Library for low-level communication with OneKey.

Intended as a "building block" for other packages.

## How to use

Use like this:

```javascript
var Link = require('@onekeyhq/link');
var LowlevelTransport = Link.Lowlevel;
var NodeHidPlugin = Link.NodeHid;

var link = new LowlevelTransport(new NodeHidPlugin());

var config = fetch('https://connect.onekey.so/data/config.json').then(function (response) {
  if (response.ok) {
    return response.text();
  } else {
    throw new Error(`Fetch error ${response.status}`);
  }
});

return link.init().then(function () {
  return config.then(function (configData) {
    return link.configure(configData);
  });
}).then(function () {
  return link.enumerate();
}).then(function (devices) {
  return link.acquire(devices[0].path);
}).then(function (session) {
  return link.call(session, 'GetFeatures', {}).then(function (features) {
    console.log(features);
    return link.release(session);
  });
}).catch(function (error) {
  console.error(error);
});

```

## Notes

Source is annotated with Flow types, so it's more obvious what is going on from source code.

## Flow

If you want to use flow for typechecking, just include the file as normally, it will automatically use the included flow file. However, you need to add `flowtype/*.js` to your `[libs]` (or copy it yourself from flow-typed repository), and probably libs from flowconfig.

## License

LGPLv3