Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

trezor-link

Package Overview
Dependencies
Maintainers
6
Versions
222
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trezor-link

Low level library facilitating protocol buffers based communication with Trezor devices

  • 2.0.0-beta.5
  • Source
  • npm
  • Socket score

Version published
Maintainers
6
Created
Source

Build Status NPM gitter

Library for low-level communication with Trezor.

Intended as a "building block" for other packages - it is used in trezor.js (deprecated) and trezor-connect.

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

What is the purpose

  • translate JSON payloads to binary messages using protobuf definitions comprehensible to Trezor devices
  • chunking and reading chunked messages according to the Trezor protocol
  • exposing single API for various transport methods:
    • Trezor Bridge
    • Webusb

How to use

There is a runnable example. This example launches Trezor Bridge (trezord-go) inside trezor-user-env docker container. Please make there is no other bridge instance running on your computer.

To run in simply type:

  • yarn
  • yarn build:lib
  • git submodule add --force https://github.com/trezor/trezor-common.git trezor-common
  • git submodule update --init
  • yarn pbjs -t json -p ./trezor-common/protob -o e2e/messages.json --keep-case messages-binance.proto messages-bitcoin.proto messages-bootloader.proto messages-cardano.proto messages-common.proto messages-crypto.proto messages-debug.proto messages-eos.proto messages-ethereum.proto messages-management.proto messages-monero.proto messages-nem.proto messages-ripple.proto messages-stellar.proto messages-tezos.proto messages-webauthn.proto messages.proto
  • ./e2e/run.sh;

Process of moving to monorepo

Initially, this lib was typed with Flow and over the time its dependencies became outdated. At the moment we are working on moving it into trezor-suite monorepo.

Checklist:

  • add tests
  • update dependencies (protobuf.js and others)
  • use Typescript instead of Flow
  • remove messages.json and messages-new.json and related tests.
  • resolve problem with eth tests max uint64 which can't be handled by javascript
  • finish review within trezor-link repo
  • move into trezor-suite only after merging to avoid messing with dependencies inside monorepo
  • there are bunch of comments in code marked with "[compatibility]" keyword. These are places that should be refactored later. I did not want to be forced to sync this update with update of implementation in trezor-connect
  • eslintrc.js contains bunch of disabled rules. This is because I didn't want to refactor transport layer in the first iteration. Shall be refactored once it gets into monorepo

FAQs

Package last updated on 08 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc