8000 GitHub - trezor/trezord-go: :smiling_imp: Trezor Communication Daemon (written in Go)
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

trezor/trezord-go

{"props":{"initialPayload":{"allShortcutsEnabled":false,"path":"/","repo":{"id":119376702,"defaultBranch":"master","name":"trezord-go","ownerLogin":"trezor","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2018-01-29T11:58:17.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/4146447?v=4","public":true,"private":false,"isOrgOwned":true},"currentUser":null,"refInfo":{"name":"master","listCacheKey":"v0:1744644428.0","canEdit":false,"refType":"branch","currentOid":"a58468e4f70619d4ca7dd6404bdf9bdcff8011f0"},"tree":{"items":[{"name":".github/workflows","path":".github/workflows","contentType":"directory","hasSimplifiedPath":true},{"name":"core","path":"core","contentType":"directory"},{"name":"memorywriter","path":"memorywriter","contentType":"directory"},{"name":"release","path":"release","contentType":"directory"},{"name":"scripts","path":"scripts","contentType":"directory"},{"name":"server","path":"server","contentType":"directory"},{"name":"usb","path":"usb","contentType":"directory"},{"name":"wire","path":"wire","contentType":"directory"},{"name":".dockerignore","path":".dockerignore","contentType":"file"},{"name":".editorconfig","path":".editorconfig","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".gitmodules","path":".gitmodules","contentType":"file"},{"name":".golangci.yml","path":".golangci.yml","contentType":"file"},{"name":"CHANGELOG.md","path":"CHANGELOG.md","contentType":"file"},{"name":"COPYING","path":"COPYING","contentType":"file"},{"name":"Dockerfile","path":"Dockerfile","contentType":"file"},{"name":"Makefile","path":"Makefile","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"VERSION","path":"VERSION","contentType":"file"},{"name":"docker-compose.yml","path":"docker-compose.yml","contentType":"file"},{"name":"go.mod","path":"go.mod","contentType":"file"},{"name":"go.sum","path":"go.sum","contentType":"file"},{"name":"shell.nix","path":"shell.nix","contentType":"file"},{"name":"test.py","path":"test.py","contentType":"file"},{"name":"trezord.go","path":"trezord.go","contentType":"file"}],"templateDirectorySuggestionUrl":null,"readme":null,"totalCount":25,"showBranchInfobar":false},"fileTree":null,"fileTreeProcessingTime":null,"foldersToFetch":[],"treeExpanded":false,"symbolsExpanded":false,"isOverview":true,"overview":{"banners":{"shouldRecommendReadme":false,"isPersonalRepo":false,"showUseActionBanner":false,"actionSlug":null,"actionId":null,"showProtectBranchBanner":false,"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_repo","releasePath":"/trezor/trezord-go/releases/new?marketplace=true","showPublishActionBanner":false},"interactionLimitBanner":null,"showInvitationBanner":false,"inviterName":null,"actionsMigrationBannerInfo":{"releaseTags":[],"showImmutableActionsMigrationBanner":false,"initialMigrationStatus":null}},"codeButton":{"contactPath":"/contact","isEnterprise":false,"local":{"protocolInfo":{"httpAvailable":true,"sshAvailable":null,"httpUrl":"https://github.com/trezor/trezord-go.git","showCloneWarning":null,"sshUrl":null,"sshCertificatesRequired":null,"sshCertificatesAvailable":null,"ghCliUrl":"gh repo clone trezor/trezord-go","defaultProtocol":"http","newSshKeyUrl":"/settings/ssh/new","setProtocolPath":"/users/set_protocol"},"platformInfo":{"cloneUrl":"https://desktop.github.com","showVisualStudioCloneButton":false,"visualStudioCloneUrl":"https://windows.github.com","showXcodeCloneButton":false,"xcodeCloneUrl":"xcode://clone?repo=https%3A%2F%2Fgithub.com%2Ftrezor%2Ftrezord-go","zipballUrl":"/trezor/trezord-go/archive/refs/heads/master.zip"}},"newCodespacePath":"/codespaces/new?hide_repo_select=true\u0026repo=119376702"},"popovers":{"rename":null,"renamedParentRepo":null},"commitCount":"612","overviewFiles":[{"displayName":"README.md","repoName":"trezord-go","refName":"master","path":"README.md","preferredFileType":"readme","tabName":"README","richText":"\u003carticle class=\"markdown-body entry-content container-lg\" itemprop=\"text\"\u003e\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch1 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003etrezord-go\u003c/h1\u003e\u003ca id=\"user-content-trezord-go\" class=\"anchor\" aria-label=\"Permalink: trezord-go\" href=\"#trezord-go\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/trezor/trezord-go/actions/workflows/check-go-validation.yml/badge.svg\"\u003e\u003cimg src=\"https://github.com/trezor/trezord-go/actions/workflows/check-go-validation.yml/badge.svg\" alt=\"Build status\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e \u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/trezor/trezord-go/actions/workflows/build-unsigned-installers.yml/badge.svg\"\u003e\u003cimg src=\"https://github.com/trezor/trezord-go/actions/workflows/build-unsigned-installers.yml/badge.svg\" alt=\"Installer build status\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e \u003ca href=\"https://goreportcard.com/report/trezor/trezord-go\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/b3342201a92ca161b1ad918d11afdcee31fc5aad54a504d85f4edb7bbf307bf0/68747470733a2f2f676f7265706f7274636172642e636f6d2f62616467652f7472657a6f722f7472657a6f72642d676f\" alt=\"Go Report Card\" data-canonical-src=\"https://goreportcard.com/badge/trezor/trezord-go\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eTrezor Communication Daemon aka Trezor Bridge.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003eOnly compatible with Chrome (version 53 or later) and Firefox (version 55 or later).\u003c/strong\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWe officially don't support Windows 7 and older; it could run, but we don't guarantee it.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eWhat does trezord do and why it is needed?\u003c/h2\u003e\u003ca id=\"user-content-what-does-trezord-do-and-why-it-is-needed\" class=\"anchor\" aria-label=\"Permalink: What does trezord do and why it is needed?\" href=\"#what-does-trezord-do-and-why-it-is-needed\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTrezord is a tiny http server, that allows webpages (like Trezor Suite in web mode) to communicate with Trezor directly.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eOur new devices now support WebUSB, which should eliminate the need for Trezor Bridge; however, there are some reasons, why bridge is still needed.\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eFirefox does not allow WebUSB (\u003ca href=\"https://github.com/mozilla/standards-positions/issues/100\" data-hovercard-type=\"issue\" data-hovercard-url=\"/mozilla/standards-positions/issues/100/hovercard\"\u003esee discussion here\u003c/a\u003e).\u003c/li\u003e\n\u003cli\u003eDevices with old firmware (2018 and older) support only HID and not WebUSB.\u003c/li\u003e\n\u003cli\u003eWebUSB does not allow synchronization of USB access between domains.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eInstall and run from source\u003c/h2\u003e\u003ca id=\"user-content-install-and-run-from-source\" class=\"anchor\" aria-label=\"Permalink: Install and run from source\" href=\"#install-and-run-from-source\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003etrezord-go requires go \u0026gt;= 1.18.\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"git clone --recursive https://github.com/trezor/trezord-go.git\ncd trezord-go\ngo build .\n./trezord-go -h\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003egit clone --recursive https://github.com/trezor/trezord-go.git\ncd trezord-go\ngo build .\n./trezord-go -h\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eOn Linux don't forget to install the \u003ca href=\"https://github.com/trezor/trezor-common/blob/master/udev/51-trezor.rules\"\u003eudev rules\u003c/a\u003e if you are running from source and not using pre-built packages.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDebug mode\u003c/h4\u003e\u003ca id=\"user-content-debug-mode\" class=\"anchor\" aria-label=\"Permalink: Debug mode\" href=\"#debug-mode\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eWhen built with \u003ccode\u003e-tags debug\u003c/code\u003e a debug mode is enabled. This disables CORS which is helpful for local development and when run inside a docker image.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eBuild release packages\u003c/h2\u003e\u003ca id=\"user-content-build-release-packages\" class=\"anchor\" aria-label=\"Permalink: Build release packages\" href=\"#build-release-packages\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003ePrerequisites:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003einstall \u003ccode\u003edocker\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003emake sure \u003ccode\u003edocker\u003c/code\u003e is in \u003ccode\u003e$PATH\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003emake build-release\u003c/code\u003e; the installers are in \u003ccode\u003erelease/installers\u003c/code\u003e, binaries in \u003ccode\u003erelease/binaries\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eThe base docker images are all built for both ARM and Intel 64, so they should work on both x64 architectures and ARM.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThe base images are quite big and can take a while to download (mainly the musl cross-compiler, about 1 GB) and build (mainly the Rust-based apple-codesign). However, it should be cached correctly and run fast next time.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSigning release packages\u003c/h2\u003e\u003ca id=\"user-content-signing-release-packages\" class=\"anchor\" aria-label=\"Permalink: Signing release packages\" href=\"#signing-release-packages\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eBy default, the binaries and installers are unsigned and unnotarized. The build does not require any certificates or private keys, but produces unsigned binaries and packages.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThe notarization and signing is all done in Docker, so it can run everywhere. (No need to run the mac notarization on macOS, etc.)\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eIf you want to sign the packages, you need the following:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eFor Linux, you need to put GPG private key into \u003ccode\u003erelease/linux/privkey.asc\u003c/code\u003e.\u003c/li\u003e\n\u003cli\u003eFor Windows, you need to put GPG private key into \u003ccode\u003erelease/windows/privkey.asc\u003c/code\u003e and an authenticode to \u003ccode\u003erelease/windows/authenticode.key\u003c/code\u003e and \u003ccode\u003erelease/windows/authenticode.crt\u003c/code\u003e.\u003c/li\u003e\n\u003cli\u003eFor macOS:\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eYou need to put GPG private key into \u003ccode\u003erelease/macos/privkey.asc\u003c/code\u003e.\u003c/li\u003e\n\u003cli\u003eThen you need to generate and put a lot of things for notarization and signing into \u003ccode\u003erelease/macos/certs\u003c/code\u003e; see the details in top comment of \u003ccode\u003erelease/macos/release.sh\u003c/code\u003e.\u003c/li\u003e\n\u003c/ol\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eAll those files are ignored by \u003ccode\u003e.gitignore\u003c/code\u003e so they are not accidentally put into git.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eEmulator support\u003c/h2\u003e\u003ca id=\"user-content-emulator-support\" class=\"anchor\" aria-label=\"Permalink: Emulator support\" href=\"#emulator-support\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTrezord supports emulators for all Trezor versions. However, you need to enable it manually; it is disabled by default. After enabling, services that work with emulator can work with all services that support trezord.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eTo enable emulator, run trezord with a parameter \u003ccode\u003e-e\u003c/code\u003e followed by port, for every emulator with an enabled port:\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ccode\u003e./trezord-go -e 21324\u003c/code\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eYou can disable all USB in order to run on some virtuaized environments, for example on CI:\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ccode\u003e./trezord-go -e 21324 -u=false\u003c/code\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAPI documentation\u003c/h2\u003e\u003ca id=\"user-content-api-documentation\" class=\"anchor\" aria-label=\"Permalink: API documentation\" href=\"#api-documentation\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ccode\u003etrezord-go\u003c/code\u003e starts a HTTP server on \u003ccode\u003ehttp://localhost:21325\u003c/code\u003e. AJAX calls are only enabled from trezor.io subdomains.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eServer supports following API calls:\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eurl \u003cbr\u003e method\u003c/th\u003e\n\u003cth\u003eparameters\u003c/th\u003e\n\u003cth\u003eresult type\u003c/th\u003e\n\u003cth\u003edescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e/\u003c/code\u003e \u003cbr\u003e POST\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e{\u003ccode\u003eversion\u003c/code\u003e: string}\u003c/td\u003e\n\u003ctd\u003eReturns current version of bridge\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e/enumerate\u003c/code\u003e \u003cbr\u003e POST\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003eArray\u0026lt;{\u003ccode\u003epath\u003c/code\u003e: string, \u003cbr\u003e\u003ccode\u003esession\u003c/code\u003e: string | null}\u0026gt;\u003c/td\u003e\n\u003ctd\u003eLists devices.\u003cbr\u003e\u003ccode\u003epath\u003c/code\u003e uniquely defines device between more connected devices. Two different devices (or device connected and disconnected) will return different paths.\u003cbr\u003eIf \u003ccode\u003esession\u003c/code\u003e is null, nobody else is using the device; if it's string, it identifies who is using it.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e/listen\u003c/code\u003e \u003cbr\u003e POST\u003c/td\u003e\n\u003ctd\u003erequest body: previous, as JSON\u003c/td\u003e\n\u003ctd\u003elike \u003ccode\u003eenumerate\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eListen to changes and returns either on change or after 30 second timeout. Compares change from \u003ccode\u003eprevious\u003c/code\u003e that is sent as a parameter. \"Change\" is both connecting/disconnecting and session change.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e/acquire/PATH/PREVIOUS\u003c/code\u003e \u003cbr\u003e POST\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003ePATH\u003c/code\u003e: path of device\u003cbr\u003e\u003ccode\u003ePREVIOUS\u003c/code\u003e: previous session (or string \"null\")\u003c/td\u003e\n\u003ctd\u003e{\u003ccode\u003esession\u003c/code\u003e: string}\u003c/td\u003e\n\u003ctd\u003eAcquires the device at \u003ccode\u003ePATH\u003c/code\u003e. By \"acquiring\" the device, you are claiming the device for yourself.\u003cbr\u003eBefore acquiring, checks that the current session is \u003ccode\u003ePREVIOUS\u003c/code\u003e.\u003cbr\u003eIf two applications call \u003ccode\u003eacquire\u003c/code\u003e on a newly connected device at the same time, only one of them succeed.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e/release/SESSION\u003c/code\u003e\u003cbr\u003ePOST\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eSESSION\u003c/code\u003e: session to release\u003c/td\u003e\n\u003ctd\u003e{}\u003c/td\u003e\n\u003ctd\u003eReleases the device with the given session.\u003cbr\u003eBy \"releasing\" the device, you claim that you don't want to use the device anymore.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e/call/SESSION\u003c/code\u003e\u003cbr\u003ePOST\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eSESSION\u003c/code\u003e: session to call\u003cbr\u003e\u003cbr\u003erequest body: hexadecimal string\u003c/td\u003e\n\u003ctd\u003ehexadecimal string\u003c/td\u003e\n\u003ctd\u003eBoth input and output are hexadecimal, encoded in following way:\u003cbr\u003efirst 2 bytes (4 characters in the hexadecimal) is the message type\u003cbr\u003enext 4 bytes (8 in hex) is length of the data\u003cbr\u003ethe rest is the actual encoded protobuf data.\u003cbr\u003eProtobuf messages are defined in \u003ca href=\"https://github.com/trezor/trezor-common/blob/master/protob/messages.proto\"\u003ethis protobuf file\u003c/a\u003e and the app, calling trezord, should encode/decode it itself.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e/post/SESSION\u003c/code\u003e\u003cbr\u003ePOST\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eSESSION\u003c/code\u003e: session to call\u003cbr\u003e\u003cbr\u003erequest body: hexadecimal string\u003c/td\u003e\n\u003ctd\u003e0\u003c/td\u003e\n\u003ctd\u003eSimilar to \u003ccode\u003ecall\u003c/code\u003e, just doesn't read response back. Also forces the message to be sent even if another call is in progress. Usable mainly for debug link and workflow cancelling on Trezor.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003e/read/SESSION\u003c/code\u003e\u003cbr\u003ePOST\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eSESSION\u003c/code\u003e: session to call\u003c/td\u003e\n\u003ctd\u003e0\u003c/td\u003e\n\u003ctd\u003eSimilar to \u003ccode\u003ecall\u003c/code\u003e, just doesn't post, only reads. Usable mainly for debug link.\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDebug link support\u003c/h2\u003e\u003ca id=\"user-content-debug-link-support\" class=\"anchor\" aria-label=\"Permalink: Debug link support\" href=\"#debug-link-support\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTrezord has support for debug link.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eTo support an emulator with debug link, run\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ccode\u003e./trezord-go -ed 21324:21325 -u=false\u003c/code\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003ethis will detect emulator debug link on port 21325, with regular device on 21324.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eTo support WebUSB devices with debug link, no option is needed, just run trezord-go.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eIn the \u003ccode\u003eenumerate\u003c/code\u003e and \u003ccode\u003elisten\u003c/code\u003e results, there are now two new fields: \u003ccode\u003edebug\u003c/code\u003e and \u003ccode\u003edebugSession\u003c/code\u003e. \u003ccode\u003edebug\u003c/code\u003e signals that device can receive debug link messages.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eSession management is separate for debug link and normal interface, so you can have two applications - one controlling trezor and one \"normal\".\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThere are new calls:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003e/debug/acquire/PATH\u003c/code\u003e, which has the same path as normal \u003ccode\u003eacquire\u003c/code\u003e, and returns a \u003ccode\u003eSESSION\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e/debug/release/SESSION\u003c/code\u003e releases session\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e/debug/call/SESSION\u003c/code\u003e, \u003ccode\u003e/debug/post/SESSION\u003c/code\u003e, \u003ccode\u003e/debug/read/SESSION\u003c/code\u003e work as with normal interface\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eThe session IDs for debug link start with the string \"debug\".\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCopyright\u003c/h2\u003e\u003ca id=\"user-content-copyright\" class=\"anchor\" aria-label=\"Permalink: Copyright\" href=\"#copyright\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e(C) 2018 Karel Bilek, Jan Pochyla\u003c/li\u003e\n\u003cli\u003eCORS Copyright (c) 2013 The Gorilla Handlers Authors, \u003ca href=\"https://github.com/gorilla/handlers/blob/master/LICENSE\"\u003eBSD license\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e(c) 2017 Jason T. Harris (also see \u003ca href=\"https://github.com/deadsy/libusb\"\u003ehttps://github.com/deadsy/libusb\u003c/a\u003e for comprehensive list)\u003c/li\u003e\n\u003cli\u003e(C) 2017 Péter Szilágyi (also see \u003ca href=\"https://github.com/karalabe/hid\"\u003ehttps://github.com/karalabe/hid\u003c/a\u003e for comprehensive list)\u003c/li\u003e\n\u003cli\u003e(C) 2010-2016 Pete Batard \u003ca href=\"mailto:pete@akeo.ie\"\u003epete@akeo.ie\u003c/a\u003e (also see \u003ca href=\"https://github.com/pbatard/libwdi/\"\u003ehttps://github.com/pbatard/libwdi/\u003c/a\u003e for comprehensive list)\u003c/li\u003e\n\u003cli\u003eLicensed under LGPLv3\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/article\u003e","loaded":true,"timedOut":false,"errorMessage":null,"headerInfo":{"toc":[{"level":1,"text":"trezord-go","anchor":"trezord-go","htmlText":"trezord-go"},{"level":2,"text":"What does trezord do and why it is needed?","anchor":"what-does-trezord-do-and-why-it-is-needed","htmlText":"What does trezord do and why it is needed?"},{"level":2,"text":"Install and run from source","anchor":"install-and-run-from-source","htmlText":"Install and run from source"},{"level":4,"text":"Debug mode","anchor":"debug-mode","htmlText":"Debug mode"},{"level":2,"text":"Build release packages","anchor":"build-release-packages","htmlText":"Build release packages"},{"level":2,"text":"Signing release packages","anchor":"signing-release-packages","htmlText":"Signing release packages"},{"level":2,"text":"Emulator support","anchor":"emulator-support","htmlText":"Emulator support"},{"level":2,"text":"API documentation","anchor":"api-documentation","htmlText":"API documentation"},{"level":2,"text":"Debug link support","anchor":"debug-link-support","htmlText":"Debug link support"},{"level":2,"text":"Copyright","anchor":"copyright","htmlText":"Copyright"}],"siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Ftrezor%2Ftrezord-go"}},{"displayName":"COPYING","repoName":"trezord-go","refName":"master","path":"COPYING","preferredFileType":"license","tabName":"LGPL-3.0","richText":null,"loaded":false,"timedOut":false,"errorMessage":null,"headerInfo":{"toc":null,"siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Ftrezor%2Ftrezord-go"}},{"displayName":"SECURITY.md","repoName":".github","refName":"master","path":"SECURITY.md","preferredFileType":"security","tabName":"Security","richText":null,"loaded":false,"timedOut":false,"errorMessage":null,"headerInfo":{"toc":null,"siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Ftrezor%2Ftrezord-go"}}],"overviewFilesProcessingTime":0}},"appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-7d7eb7c71814.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-708ec8ade250.js","githubDevUrl":null,"enabled_features":{"copilot_workspace":null,"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true,"github_models_repo_integration":false}}}}

Repository files navigation

trezord-go

Build status Installer build status Go Report Card

Trezor Communication Daemon aka Trezor Bridge.

Only compatible with Chrome (version 53 or later) and Firefox (version 55 or later).

We officially don't support Windows 7 and older; it could run, but we don't guarantee it.

What does trezord do and why it is needed?

Trezord is a tiny http server, that allows webpages (like Trezor Suite in web mode) to communicate with Trezor directly.

Our new devices now support WebUSB, which should eliminate the need for Trezor Bridge; however, there are some reasons, why bridge is still needed.

  1. Firefox does not allow WebUSB (see discussion here).
  2. Devices with old firmware (2018 and older) support only HID and not WebUSB.
  3. WebUSB does not allow synchronization of USB access between domains.

Install and run from source

trezord-go requires go >= 1.18.

git clone --recursive https://github.com/trezor/trezord-go.git
cd trezord-go
go build .
./trezord-go -h

On Linux don't forget to install the udev rules if you are running from source and not using pre-built packages.

Debug mode

When built with -tags debug a debug mode is enabled. This disables CORS which is helpful for local development and when run inside a docker image.

Build release packages

Prerequisites:

  • install docker
  • make sure docker is in $PATH
  • make build-release; the installers are in release/installers, binaries in release/binaries

The base docker images are all built for both ARM and Intel 64, so they should work on both x64 architectures and ARM.

The base images are quite big and can take a while to download (mainly the musl cross-compiler, about 1 GB) and build (mainly the Rust-based apple-codesign). However, it should be cached correctly and run fast next time.

Signing release packages

By default, the binaries and installers are unsigned and unnotarized. The build does not require any certificates or private keys, but produces unsigned binaries and packages.

The notarization and signing is all done in Docker, so it can run everywhere. (No need to run the mac notarization on macOS, etc.)

If you want to sign the packages, you need the following:

  • For Linux, you need to put GPG private key into release/linux/privkey.asc.
  • For Windows, you need to put GPG private key into release/windows/privkey.asc and an authenticode to release/windows/authenticode.key and release/windows/authenticode.crt.
  • For macOS:
    1. You need to put GPG private key into release/macos/privkey.asc.
    2. Then you need to generate and put a lot of things for notarization and signing into release/macos/certs; see the details in top comment of release/macos/release.sh.

All those files are ignored by .gitignore so they are not accidentally put into git.

Emulator support

Trezord supports emulators for all Trezor versions. However, you need to enable it manually; it is disabled by default. After enabling, services that work with emulator can work with all services that support trezord.

To enable emulator, run trezord with a parameter -e followed by port, for every emulator with an enabled port:

./trezord-go -e 21324

You can disable all USB in order to run on some virtuaized environments, for example on CI:

./trezord-go -e 21324 -u=false

API documentation

trezord-go starts a HTTP server on http://localhost:21325. AJAX calls are only enabled from trezor.io subdomains.

Server supports following API calls:

url
method
parameters result type description
/
POST
{version: string} Returns current version of bridge
/enumerate
POST
Array<{path: string,
session: string | null}>
Lists devices.
path uniquely defines device between more connected devices. Two different devices (or dev 8000 ice connected and disconnected) will return different paths.
If session is null, nobody else is using the device; if it's string, it identifies who is using it.
/listen
POST
request body: previous, as JSON like enumerate Listen to changes and returns either on change or after 30 second timeout. Compares change from previous that is sent as a parameter. "Change" is both connecting/disconnecting and session change.
/acquire/PATH/PREVIOUS
POST
PATH: path of device
PREVIOUS: previous session (or string "null")
{session: string} Acquires the device at PATH. By "acquiring" the device, you are claiming the device for yourself.
Before acquiring, checks that the current session is PREVIOUS.
If two applications call acquire on a newly connected device at the same time, only one of them succeed.
/release/SESSION
POST
SESSION: session to release {} Releases the device with the given session.
By "releasing" the device, you claim that you don't want to use the device anymore.
/call/SESSION
POST
SESSION: session to call

request body: hexadecimal string
hexadecimal string Both input and output are hexadecimal, encoded in following way:
first 2 bytes (4 characters in the hexadecimal) is the message type
next 4 bytes (8 in hex) is length of the data
the rest is the actual encoded protobuf data.
Protobuf messages are defined in this protobuf file and the app, calling trezord, should encode/decode it itself.
/post/SESSION
POST
SESSION: session to call

request body: hexadecimal string
0 Similar to call, just doesn't read response back. Also forces the message to be sent even if another call is in progress. Usable mainly for debug link and workflow cancelling on Trezor.
/read/SESSION
POST
SESSION: session to call 0 Similar to call, just doesn't post, only reads. Usable mainly for debug link.

Debug link support

Trezord has support for debug link.

To support an emulator with debug link, run

./trezord-go -ed 21324:21325 -u=false

this will detect emulator debug link on port 21325, with regular device on 21324.

To support WebUSB devices with debug link, no option is needed, just run trezord-go.

In the enumerate and listen results, there are now two new fields: debug and debugSession. debug signals that device can receive debug link messages.

Session management is separate for debug link and normal interface, so you can have two applications - one controlling trezor and one "normal".

There are new calls:

  • /debug/acquire/PATH, which has the same path as normal acquire, and returns a SESSION
  • /debug/release/SESSION releases session
  • /debug/call/SESSION, /debug/post/SESSION, /debug/read/SESSION work as with normal interface

The session IDs for debug link start with the string "debug".

Copyright

0