# @trezor/protobuf

Latest version **10.0.1** (published 2026-09-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @trezor/protobuf
pnpm add @trezor/protobuf
yarn add @trezor/protobuf
bun add @trezor/protobuf
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 10.0.1 |
| Published | 2026-09-25 |
| First published | 2023-08-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1060 |
| Maintainers | prusnak, tsusanka-sl, trezor-ci, trezor-admin |

## Links

- npm: https://www.npmjs.com/package/@trezor/protobuf
- Repository: https://github.com/trezor/trezor-suite
- Issues: https://github.com/trezor/trezor-suite/issues
- npm.io page: https://npm.io/package/@trezor/protobuf

## Dependencies (2)

- [@bufbuild/protobuf](https://npm.io/package/@bufbuild/protobuf.md) ^2.11.0
- [@trezor/schema-utils](https://npm.io/package/@trezor/schema-utils.md) 10.0.1

## Recent versions

- 10.0.1 (latest) — 2026-09-25
- 10.0.0-beta.3 (beta) — 2026-09-17
- 10.0.0-alpha.1 (alpha) — 2026-05-15
- 10.0.0 — 2026-09-22
- 10.0.0-beta.2 — 2026-09-16
- 10.0.0-beta.1 — 2026-07-30
- 1.5.3 — 2026-04-22
- 1.5.2 — 2026-02-26
- 1.5.2-beta.1 — 2026-02-25
- 1.5.1 — 2025-12-22
- 1.5.1-beta.1 — 2025-12-19
- 1.5.0 — 2025-12-16
- 1.5.0-beta.2 — 2025-12-09
- 1.5.0-beta.1 — 2025-11-25
- 1.4.5-beta.1 — 2025-11-12
- … 56 more at https://npm.io/package/@trezor/protobuf/versions

## README

# @trezor/protobuf

Library for handling protobuf interfaces with Trezor, powered by [`@bufbuild/protobuf`](https://www.npmjs.com/package/@bufbuild/protobuf).

## From Protobuf to TypeScript

This section describes how the definitions of protobuf messages maintained in the
firmware repo are semi-automatically translated to TypeScript definitions that are used in Connect codebase and by Connect users respectively.

### The short version

In order to be able to use new features of trezor-firmware you need to update protobuf definitions.

1. `yarn update-protobuf <branch-name>` to generate new `./src/definitions/*_pb.ts` and `./src/types/messages.ts`. If you don't provide branch-name argument, 'main' will be used.

### In depth explanation

The beginning and source of truth are the `.proto` definitions in the [firmware repository](https://github.com/trezor/trezor-firmware/tree/main/common/protob).

The `.proto` definitions are compiled to TypeScript modules (`*_pb.ts`) using `@bufbuild/protobuf`. These generated modules provide static message schemas used by `ProtobufManager` for encoding/decoding and are also used to generate TypeScript type definitions.

TypeScript definitions are generated by a script in `scripts/protobuf-types.js`. The script also applies 'patches' described in `scripts/protobuf-patches.js`. The patches compensate for/fix

- The source `.proto` definitions that do not reflect the actual business logic. Usually fields marked as required which are in fact optional.
- Fields typed as `uint32`, `uint64`, `sint32`, `sint64` in protobuf that need to be represented as strings in runtime because of javascript number's insufficient range. Runtime conversion is handled automatically by `@trezor/transport`.
- Similarly, fields typed as `bytes` in protobuf may be represented as hexadecimal `string`, `Buffer`, `Uint8Array` or `Array<number>` in runtime.
- Optional protobuf fields that get typed as `<T> | undefined` but are in fact deserialized as `<T> | null`. This could be handled globally by `@trezor/transport`. The patches exist mainly for historical reasons.

All these steps are done manually and all the generated files are tracked in git.

---
_Source: https://npm.io/package/@trezor/protobuf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
