0.2.114 • Published 6 years ago

trezor-link-browser-extension v0.2.114

Weekly downloads
5
License
LGPL-3.0+
Repository
github
Last release
6 years ago

trezor-link-browser-extension

Library for low-level communication with TREZOR for browser extensions.

Intended as a "building block" for extension that talks with TREZOR.

You probably don't want to use this package directly. For communication with Trezor with a more high-level API, use trezor.js.

How to use

Use like this:

var Link = require('trezor-link-browser-extension');
var LowlevelTransport = Link.Lowlevel;
var ChromeHidPlugin = Link.ChromeHid;

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

var config = fetch('https://wallet.mytrezor.com/data/config_signed.bin').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

0.2.114

6 years ago

1.0.0-alpha.3

6 years ago

1.0.0-alpha.2

6 years ago

1.0.0-alpha.1

6 years ago

1.0.0-alpha.0

6 years ago

0.2.113

6 years ago

0.2.112

6 years ago

0.2.111

6 years ago

0.2.110

6 years ago

0.2.109

6 years ago

0.2.108

6 years ago

0.2.107

6 years ago

0.2.106

6 years ago

0.2.105

7 years ago

0.2.103

7 years ago

0.2.102

7 years ago

0.2.101

7 years ago

0.2.100

7 years ago

0.2.99

7 years ago

0.2.98

7 years ago

0.2.97

7 years ago

0.2.96

7 years ago

0.2.95

7 years ago

0.2.94

7 years ago

0.2.93

7 years ago

0.2.92

7 years ago

0.2.91

7 years ago

0.2.90

7 years ago

0.2.89

7 years ago

0.2.88

7 years ago

0.2.87

7 years ago

0.2.86

7 years ago

0.2.85

7 years ago

0.2.84

7 years ago

0.2.83

7 years ago

0.2.82

7 years ago

0.2.81

7 years ago

0.2.80

7 years ago

0.2.79

7 years ago

0.2.78

7 years ago

0.2.77

7 years ago

0.2.76

7 years ago

0.2.75

7 years ago

0.2.74

7 years ago

0.2.73

7 years ago

0.2.71

7 years ago

0.2.70

7 years ago

0.2.69

7 years ago

0.2.68

7 years ago

0.2.67

7 years ago

0.2.66

7 years ago

0.2.65

7 years ago

0.2.64

7 years ago

0.2.63

7 years ago

0.2.62

7 years ago

0.2.61

7 years ago

0.2.60

7 years ago

0.2.59

7 years ago

0.2.58

7 years ago

0.2.57

7 years ago

0.2.56

7 years ago

0.2.55

7 years ago

0.2.54

7 years ago

0.2.53

7 years ago

0.2.52

7 years ago

0.2.51

7 years ago

0.2.50

7 years ago

0.2.49

8 years ago

0.2.48

8 years ago

0.2.47

8 years ago

0.2.46

8 years ago

0.2.45

8 years ago

0.2.44

8 years ago

0.2.43

8 years ago

0.2.42

8 years ago

0.2.41

8 years ago

0.2.40

8 years ago

0.2.39

8 years ago

0.2.38

8 years ago

0.2.37

8 years ago

0.2.36

8 years ago

0.2.35

8 years ago

0.2.34

8 years ago

0.2.33

8 years ago

0.2.32

8 years ago