Trezor Flutter Plugin (Experimental)

Trezor Flutter Plugin Logo


License

Overview

The Trezor Flutter Plugin is an experimental plugin designed to provide support for Trezor hardware wallets within Flutter applications. This project aims to integrate USB (HID) and Bluetooth (BLE) communication, enabling seamless interaction with Trezor devices, such as Trezor Model T and Trezor Nano X, from your Flutter apps. Currently, this plugin is work in progress and we’re actively looking for contributors!

This project will help developers:

  • Interact with Trezor devices using both USB and Bluetooth interfaces.
  • Manage secure and private transactions using Trezor hardware wallets.
  • Build decentralized apps (DApps) and other secure applications with hardware wallet support.

⚠️ Note: This plugin is still experimental, and the full functionality is not yet implemented. We're targeting full device interaction in the next 2 weeks. See details below.

Features

  • x Bluetooth Support: The plugin includes preliminary Bluetooth Low Energy (BLE) support for Trezor Nano X. BLE scanning and connecting to the device works, but we are still in the process of finalizing the communication between Flutter and Trezor devices.
  • x USB Support: Early-stage USB serial interface support has been added for Trezor Model T. We have set up the serial interface but are still working on parsing commands and responses from the Trezor device.
  • Transaction Management: Full transaction signing and management functionality is on the roadmap for the next release.
  • Open Source & Extensible: Built with open-source principles, this plugin aims to foster collaboration, security, and extensibility for Flutter developers building wallet-enabled apps.

Current Status

This plugin is not yet fully functional, but here is what has been achieved so far:

  • Bluetooth and Serial Interfaces: We have successfully implemented the connection interfaces for both Bluetooth (BLE) and USB.
    • On Android and iOS, you can already scan for Trezor Nano X devices via Bluetooth.
    • On macOS, Linux, and Windows, the USB interface has been initialized, and you can establish a basic connection to the Trezor Model T.
  • Work in Progress: While the hardware communication layer is set up, we are still in the process of hooking it up to Trezor devices to enable command and response interaction.

Expected Progress

We plan to have a more concrete release with core functionality (including interaction with Trezor devices) within 2 weeks. Stay tuned for updates!

Installation

Add trezor_flutter as a dependency in your pubspec.yaml file:

dependencies:
  trezor_flutter: ^0.0.1

Then run:

flutter pub get

Usage Example

Bluetooth (for Trezor Nano X)

import 'package:trezor_flutter/trezor_flutter.dart';

void scanForBluetoothDevices() async {
  // Start scanning for Trezor devices over Bluetooth
  var devices = await TrezorFlutter.scanForBluetoothDevices();
  
  devices.forEach((device) {
    print('Found Trezor device: ${device.name}');
    
    // Connect to the device
    TrezorFlutter.connectToDevice(device);
  });
}

USB (for Trezor Model T)

import 'package:trezor_flutter/trezor_flutter.dart';

void connectToUSBDevice() async {
  // Connect to the first available USB device
  var usbDevice = await TrezorFlutter.connectToUSBDevice();
  
  if (usbDevice != null) {
    print('Connected to Trezor via USB: ${usbDevice.name}');
  } else {
    print('No USB devices found.');
  }
}

Roadmap

The following features are planned for future releases:

  • Device Command Parsing: Enable APDU command communication with the Trezor device.
  • Transaction Signing: Sign cryptocurrency transactions directly from the device.
  • Cross-platform Support: Ensure support across Android, iOS, macOS, Linux, and Windows.
  • Device Pin Entry & Security: Integrate secure PIN and passphrase entry.
  • Comprehensive Testing: Add full unit tests and integration tests for device interactions.

Contributions

We welcome contributions! If you'd like to help out or report issues, feel free to check out our GitHub repository or open a pull request.

Current Focus:

  • Finalizing device communication layers for Bluetooth and USB.
  • Implementing Trezor command and response parsing.

If you have experience with USB/HID, Bluetooth LE, or hardware wallets, your contributions will be especially valuable!

License

This project is licensed under the MIT License.


Made with ❤️ by open-source contributors