Skip to main content

Choose Your Package

Trezor Connect is available in different packages optimized for specific environments. Choose the package that matches your use case:

Node.js

@trezor/connectFor Node.js applications and Electron main process

Web Applications

@trezor/connect-webFor web apps with popup UI and browser transport

Browser Extensions

@trezor/connect-webextensionFor browser extensions with Manifest V3 support

React Native

@trezor/connect-mobileFor mobile apps using deep link communication

Node.js Installation

npm install @trezor/connect
The @trezor/connect package is designed for Node.js and Electron main process. It does not include browser-specific features like popup UI or WebUSB transport.

Prerequisites

  • Node.js: Version 18 or higher recommended
  • Trezor Bridge: Required for device communication

TypeScript Support

Trezor Connect includes TypeScript definitions out of the box. No additional @types packages are needed.
import TrezorConnect from '@trezor/connect';

// Full type support for all methods and responses
const result = await TrezorConnect.getAddress({
  path: "m/49'/0'/0'/0/0",
  coin: 'btc',
});

if (result.success) {
  console.log('Address:', result.payload.address);
}

Web Application Installation

npm install @trezor/connect-web
@trezor/connect-web includes additional features for web applications:
  • Popup-based UI for user interactions
  • WebUSB transport for direct browser communication
  • Automatic transport selection (WebUSB or Bridge)

Browser Requirements

  • Modern browsers: Chrome 89+, Edge 89+, Opera 75+
  • WebUSB support: For direct USB communication (optional, Bridge can be used as fallback)
  • HTTPS: Required for WebUSB transport (localhost is allowed for development)

Browser Extension Installation

npm install @trezor/connect-webextension
@trezor/connect-webextension is specifically designed for browser extensions with Manifest V3 compatibility. It handles service worker constraints and extension-specific communication patterns.

Manifest V3 Configuration

Add required permissions to your manifest.json:
manifest.json
{
  "manifest_version": 3,
  "permissions": ["storage"],
  "host_permissions": [
    "https://*.trezor.io/*"
  ],
  "content_security_policy": {
    "extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'"
  }
}

React Native Installation

npm install @trezor/connect-mobile
@trezor/connect-mobile uses deep links to communicate with Trezor Suite mobile app. Users need Trezor Suite installed on their device.

Additional Setup

Configure deep link handling in your React Native app:
app.json
{
  "expo": {
    "scheme": "myapp",
    "ios": {
      "bundleIdentifier": "com.myapp"
    },
    "android": {
      "package": "com.myapp"
    }
  }
}

Package Version

Current version: 10.0.0-alpha.1
Version 10 is currently in alpha stage. The API is stable but may receive breaking changes before the final release. For production applications, consider using the latest stable v9 release.
To install a specific version:
npm install @trezor/[email protected]

Peer Dependencies

Trezor Connect requires tslib as a peer dependency:
npm install tslib@^2.6.2
Most package managers will automatically install peer dependencies, but if you encounter issues, install it manually.

Verification

Verify your installation by checking the installed version:
npm list @trezor/connect

Build Tools Configuration

Webpack

If you’re using Webpack, you may need to configure polyfills for Node.js core modules:
webpack.config.js
module.exports = {
  resolve: {
    fallback: {
      crypto: require.resolve('crypto-browserify'),
      stream: require.resolve('stream-browserify'),
      buffer: require.resolve('buffer/'),
    },
  },
  plugins: [
    new webpack.ProvidePlugin({
      Buffer: ['buffer', 'Buffer'],
      process: 'process/browser',
    }),
  ],
};
Install the required polyfills:
npm install crypto-browserify stream-browserify buffer process

Vite

For Vite projects, add polyfills configuration:
vite.config.js
import { defineConfig } from 'vite';
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill';

export default defineConfig({
  optimizeDeps: {
    esbuildOptions: {
      define: {
        global: 'globalThis',
      },
      plugins: [
        NodeGlobalsPolyfillPlugin({
          buffer: true,
        }),
        NodeModulesPolyfillPlugin(),
      ],
    },
  },
});

Next.js

For Next.js applications using @trezor/connect-web:
next.config.js
module.exports = {
  webpack: (config, { isServer }) => {
    if (!isServer) {
      config.resolve.fallback = {
        ...config.resolve.fallback,
        crypto: require.resolve('crypto-browserify'),
        stream: require.resolve('stream-browserify'),
      };
    }
    return config;
  },
};

Troubleshooting

If you see errors about missing modules like crypto or stream, you need to configure polyfills for Node.js core modules. See the build tools configuration section above.
Ensure you have tslib installed as a peer dependency:
npm install tslib@^2.6.2
If the SDK cannot connect to devices:
  1. Ensure Trezor Bridge is installed and running
  2. Check that your device is connected via USB
  3. Try restarting Trezor Bridge service
  4. On Linux, check USB permissions
WebUSB requires:
  • HTTPS connection (localhost is allowed for development)
  • Modern browser with WebUSB support
  • User permission to access USB devices
If WebUSB is not available, the SDK will fall back to Trezor Bridge.

Next Steps

Initialize Trezor Connect

Learn how to initialize and configure Trezor Connect in your application

Build docs developers (and LLMs) love