web3_universal_trezor 0.1.0+1 copy "web3_universal_trezor: ^0.1.0+1" to clipboard
web3_universal_trezor: ^0.1.0+1 copied to clipboard

Trezor hardware wallet integration for Web3 Universal SDK. Supports secure signing via Trezor Connect.

dart_web3_trezor #

License: MIT

Industry-standard Trezor hardware wallet integration for Dart. Communicates with Trezor One, Trezor T, and Trezor Safe devices via the Trezor Protobuf (Bridge) protocol.

πŸš€ Features #

  • Protobuf Support: High-performance serialization using official Trezor message definitions.
  • USB HID / Bridge: Direct communication on Desktop and support for Trezor Bridge on Web/Mobile.
  • Passphrase Security: Native handling of the Trezor "hidden wallet" (passphrase) entry.
  • Type-Safe Commands: Typed requests for Address, Signing, and CipherKey derivation.

Usage Flow #

sequenceDiagram
    participant A as App
    participant T as TrezorClient
    participant D as Device
    A->>T: connect()
    T->>D: Initialize
    A->>T: getAddress(path)
    T->>D: PB.GetAddress
    D-->>D: PIN Entry
    D-->>T: address result
    T-->>A: EthereumAddress

πŸ—οΈ Architecture #

graph LR
    App[Dart App] --> PB[Protobuf Encoder]
    PB --> Buffer[Byte Stream]
    Buffer --> Trezor[Trezor Device]
    
    subgraph UI [On-Device PIN]
        PIN[PIN Entry]
        Pass[Passphrase]
    end
    
    Trezor --> UI

πŸ“š Technical Reference #

Core Classes #

Class Responsibility
TrezorClient The primary interface for device commands.
TrezorMessage Wrapper for specific protobuf-defined interactions.
TrezorTransport Strategy for USB vs. Bridge communication.
TrezorSigner Integration with the dart_web3_signer interface.

πŸ›‘οΈ Security Considerations #

  • PIN Entry: The SDK supports remote PIN entry for UI flexibility, but encourage users to enter PINs on the device (Trezor T) when possible for maximum security.
  • Passphrase Risk: Emphasize that a lost Trezor passphrase means permanent loss of funds. The SDK provides clear hooks for passphrase prompting.
  • Code Audit: The Trezor integration touches sensitive byte-level logic. This module is written in pure Dart to be easily auditable.

πŸ’» Usage #

Signing a Message #

import 'package:dart_web3_trezor/dart_web3_trezor.dart';

void main() async {
  final trezor = TrezorClient.usb();
  await trezor.connect();

  final signature = await trezor.signMessage(
    message: "I am the owner of this wallet",
    path: "m/44'/60'/0'/0/0",
  );

  print('Signed by Trezor: $signature');
}

πŸ“¦ Installation #

dependencies:
  dart_web3_trezor: ^0.1.0
0
likes
140
points
2
downloads

Publisher

unverified uploader

Weekly Downloads

Trezor hardware wallet integration for Web3 Universal SDK. Supports secure signing via Trezor Connect.

Homepage
Repository (GitHub)
View/report issues

Topics

#web3 #hardware-wallet #trezor

Documentation

API reference

License

MIT (license)

Dependencies

web3_universal_abi, web3_universal_core, web3_universal_crypto, web3_universal_signer

More

Packages that depend on web3_universal_trezor