Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
fd40efd
feat: add new hardware entropy type option
montelaidev Mar 5, 2026
cd75414
feat: ledger dmk bridge and middleware fix
montelaidev Mar 12, 2026
986bddb
fix: use ble for bridge
montelaidev Mar 12, 2026
e434b83
fix: rename bridge and transport to be mobile specific
montelaidev Mar 12, 2026
c27079a
fix: remove patch
montelaidev Mar 12, 2026
b3e201b
Merge remote-tracking branch 'origin/main' into feat/ledger-dmk-mobile
montelaidev May 27, 2026
424c816
chore: add .worktrees/ to .gitignore
montelaidev May 28, 2026
e80fc5b
feat(speculos): add @metamask/speculos and @metamask/speculos-up pack…
montelaidev May 28, 2026
5b74d06
fix(speculos): resolve all ESLint errors across both packages
montelaidev May 28, 2026
e7361c9
feat: update to hw-emulator
montelaidev May 28, 2026
aea9751
fix: remove not used
montelaidev May 28, 2026
5320a49
fix: retry
montelaidev May 28, 2026
a73de59
revert: ledger code
montelaidev May 28, 2026
50391d0
fix: readme and licence
montelaidev May 28, 2026
abde647
fix: remove the download ability
montelaidev May 28, 2026
8c2a839
fix: update lock
montelaidev May 28, 2026
e3611c6
chore: add changelog
montelaidev May 28, 2026
4bf3baf
fix: lint, add jsdoc and pass env to docker
montelaidev May 28, 2026
0c3023d
feat: add speculos up
montelaidev May 29, 2026
c769de1
fix: address comments
montelaidev May 29, 2026
c019355
fix: yarn lock
montelaidev May 29, 2026
e843f55
fix: display env
montelaidev May 29, 2026
85a9ca9
fix: changelog and readme
montelaidev May 29, 2026
22cfc1a
fix: seed
montelaidev May 30, 2026
45eb689
feat: create default binary and scripts to generate binary
montelaidev May 30, 2026
8f2d47b
feat: create default binary and scripts to generate binary
montelaidev May 30, 2026
9ae4604
fix: test and lint
montelaidev May 31, 2026
c77d9ee
fix: package name and lint
montelaidev May 31, 2026
08e9687
fix: change runner type
montelaidev May 31, 2026
0ab7c8c
fix: lint
montelaidev May 31, 2026
de887b2
fix: lint and have ci only build linux
montelaidev May 31, 2026
590c0c2
chore: update changelog
montelaidev Jun 1, 2026
49d4aaf
Merge remote-tracking branch 'origin/main' into feat/speculos-packages
montelaidev Jun 13, 2026
579c011
feat: add @metamask/speculos-ble package
montelaidev Jun 14, 2026
a723d14
refactor: merge @metamask/speculos-ble into @metamask/hw-emulator
montelaidev Jun 15, 2026
ea98d3f
feat(hw-emulator): add env-var venv resolution and onLog to SpeculosB…
montelaidev Jun 16, 2026
5125af1
feat(hw-emulator): add QR hardware wallet emulator
montelaidev Jun 20, 2026
fceda3f
chore(hw-emulator): add Trezor R1 spike scaffolding
montelaidev Jun 20, 2026
685544f
chore(hw-emulator): record Trezor R1 spike outcome
montelaidev Jun 20, 2026
959266d
chore(hw-emulator): add Trezor C2 PNA-confirmation spike
montelaidev Jun 20, 2026
b781c0b
chore(hw-emulator): add Trezor zero-source-change transport spike
montelaidev Jun 22, 2026
6ee20ed
feat(hw-emulator/trezor): add constants and model profiles
montelaidev Jun 23, 2026
9d252e0
feat(hw-emulator/trezor): add Trezor hardware wallet emulator
montelaidev Jun 23, 2026
e847dde
fix(hw-emulator/trezor): simplify sidecar-manager, default-wire trezo…
montelaidev Jun 23, 2026
469db52
fix(hw-emulator/trezor): use node-bridge, retry controller, bind IPv4
montelaidev Jun 23, 2026
20b6e4a
fix(hw-emulator/trezor): CORS proxy with Origin forwarding, dual-port
montelaidev Jun 23, 2026
c8e6059
feat(trezor): add Trezor hardware wallet emulator + lazyLoad IN_TEST …
montelaidev Jun 27, 2026
ad65d29
docs: add master hardware wallet emulator architecture document
montelaidev Jun 27, 2026
e21a9fa
docs(plans): hardware-wallet E2E expansion — design + execution plan
montelaidev Jun 29, 2026
9997cb3
fix: update types
montelaidev Jul 10, 2026
f194da3
Merge remote-tracking branch 'origin/main' into feat/hw-emulators-master
montelaidev Aug 18, 2026
459cd72
chore(hw-emulator): untrack archived spike directories
montelaidev Aug 18, 2026
ac91826
fix(keyring-eth-trezor): remove IN_TEST env-var escape hatch from laz…
montelaidev Aug 18, 2026
3767aca
fix(speculos-up): fail-closed checksums, HTTPS-only downloads, harden…
montelaidev Aug 18, 2026
908f5d2
chore(docs): reformat tables and specs for oxfmt
montelaidev Aug 18, 2026
2c355c8
fix(hw-emulator/ledger): lifecycle leaks, error handling, readability
montelaidev Aug 18, 2026
df16425
fix(hw-emulator/qr): decoding/rendering hardening and readability
montelaidev Aug 18, 2026
422ee52
fix(hw-emulator/ble): protocol hardening and test correctness for the…
montelaidev Aug 18, 2026
d5825f8
fix(hw-emulator/trezor): sidecar lifecycle, controller robustness, re…
montelaidev Aug 18, 2026
89ce750
chore(hw-emulator): CI hardening, pinned image, repo-standard metadata
montelaidev Aug 18, 2026
7226385
fix(hw-emulator): half-start teardown and post-disconnect reconnect g…
montelaidev Aug 18, 2026
28119e5
docs(hw-emulator): changelog and README for review fixes
montelaidev Aug 18, 2026
1d86c0e
fix(hw-emulator): exclude spike dirs from jest test discovery
montelaidev Aug 18, 2026
b992f25
Merge branch 'main' into feat/hw-emulators-master
montelaidev Sep 10, 2026
96eed47
fix(hw-emulator): pin protobuf for bumble netsim transport
montelaidev Sep 15, 2026
f3be1fd
fix(hw-emulator): raise speculos-ble APDU exchange timeout, env-overr…
montelaidev Sep 21, 2026
7177253
chore: remove branch-local docs and CONTEXT.md
montelaidev Sep 21, 2026
1df080e
refactor(hw-emulator): rename python_src/python_tests to standard pyt…
montelaidev Sep 21, 2026
caed780
Merge remote-tracking branch 'origin/main' into feat/hw-emulators-master
montelaidev Nov 3, 2026
ed6877e
fix(speculos-up,hw-emulator): resolve PR #560 review findings
montelaidev Nov 3, 2026
2a73ca3
chore(speculos-up,hw-emulator): align Node engine with the repo (>=22)
montelaidev Nov 3, 2026
2fa05c3
fix(speculos-up): resolve install entries from sourceDir, drop Dirent…
montelaidev Nov 3, 2026
b4c309c
Potential fix for pull request finding 'CodeQL / Server-side request …
montelaidev Nov 3, 2026
31708a0
ci(build-speculos): pin actions to SHAs; drop softprops/action-gh-rel…
montelaidev Nov 3, 2026
02a5827
Merge remote-tracking branch 'origin/feat/speculos-packages' into fea…
montelaidev Nov 3, 2026
3e4f809
Potential fix for pull request finding 'CodeQL / Server-side request …
montelaidev Nov 3, 2026
47dde78
ci(build-speculos): set persist-credentials: false on checkout
montelaidev Nov 3, 2026
989a82b
Merge remote-tracking branch 'origin/feat/speculos-packages' into fea…
montelaidev Nov 3, 2026
ab80919
Merge remote-tracking branch 'origin/main' into feat/speculos-packages
montelaidev Dec 3, 2026
fd1d0e5
fix(hw-emulator,speculos-up): unbreak lint, tests and changelogs
montelaidev Dec 3, 2026
bf15811
feat(speculos-up): bump bundled Speculos from 0.25.13 to 0.27.8
montelaidev Dec 3, 2026
0ef3dc6
fix: upstream url
montelaidev Dec 3, 2026
dab34a0
chore(hw-emulator, speculos-up): bump dependencies to latest
montelaidev Dec 4, 2026
e30e4fe
chore(hw-emulator): replace @metamask/bip39 with ethereum-cryptograph…
montelaidev Dec 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .depcheckrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
ignore-patterns:
- '.yarn'
- 'dist/'
# Python virtualenv created by scripts/setup-python.sh
- '.venv/'
ignores:
# Ignore depcheck itself (seems to be required for monorepos)
- 'depcheck'
Expand Down Expand Up @@ -31,3 +33,7 @@ ignores:
# Ignore dependency that is used with jest "directives" (thus, they cannot be detected
# by depcheck properly)
- 'jest-environment-jsdom'
# @metamask/hw-emulator: imported via a relative source path (documented
# workaround in src/qr/emulator.test.ts — the sibling package's name does
# not match its directory and its v2 build is broken)
- '@metamask/eth-qr-keyring'
134 changes: 134 additions & 0 deletions .github/workflows/build-speculos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Build Speculos Binary

on:
workflow_dispatch:
inputs:
version:
description: 'Speculos version to build'
required: true
default: '0.27.8'
push:
tags:
- 'speculos-v*'

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read

outputs:
version: ${{ steps.version.outputs.version }}

steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
with:
persist-credentials: false

- name: Resolve and validate version
id: version
env:
INPUT_VERSION: ${{ github.event.inputs.version }}
TAG_VERSION: ${{ github.ref_name }}
run: |
# Precedence: dispatch input → pushed tag name → default.
if [ -n "${INPUT_VERSION}" ]; then
VERSION="${INPUT_VERSION}"
elif [[ "${TAG_VERSION}" == speculos-v* ]]; then
VERSION="${TAG_VERSION#speculos-v}"
else
VERSION="0.27.8"
fi
if ! printf '%s' "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "::error::Invalid Speculos version '${VERSION}': expected MAJOR.MINOR.PATCH (e.g. 0.27.8)"
exit 1
fi
printf 'version=%s\n' "$VERSION" >> "$GITHUB_OUTPUT"

- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Pinned for reproducible builds; keep in sync with
# packages/speculos-up/scripts/build-speculos*.sh.
pip install pyinstaller==6.14.1

- name: Install speculos
env:
SPECULOS_VERSION: ${{ steps.version.outputs.version }}
run: |
pip install "speculos==${SPECULOS_VERSION}"
# pkg_resources (bundled by PyInstaller) imports backports.tarfile at runtime.
pip install backports.tarfile

- name: Build standalone binary
run: |
mkdir -p dist
# 0.27 moved imports into speculos/__init__.py, so it cannot be the entry script.
printf 'from speculos.main import main\nmain()\n' > speculos-entry.py
pyinstaller \
--onefile \
--name speculos \
--distpath dist \
--workpath build \
--noupx \
--collect-all speculos \
speculos-entry.py

- name: Smoke test binary
run: ./dist/speculos --help > /dev/null

- name: Verify binary architecture
run: |
file dist/speculos | tee /tmp/speculos-file.txt
grep -Fq 'ELF' /tmp/speculos-file.txt
grep -Fq 'x86-64' /tmp/speculos-file.txt

Comment thread
cursor[bot] marked this conversation as resolved.
Resolved
- name: Package archive
env:
SPECULOS_VERSION: ${{ steps.version.outputs.version }}
run: |
cd dist
tar -czf "speculos-v${SPECULOS_VERSION}-linux-amd64.tar.gz" speculos

- name: Upload build artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: speculos-linux-amd64
path: dist/speculos-v*-linux-amd64.tar.gz
if-no-files-found: error

release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: speculos-linux-*
path: dist
merge-multiple: true

- name: Create or update GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SPECULOS_VERSION: ${{ needs.build.outputs.version }}
RELEASE_TAG: speculos-v${{ needs.build.outputs.version }}
run: |
gh release view "${RELEASE_TAG}" \
|| gh release create "${RELEASE_TAG}" \
--title "Speculos ${SPECULOS_VERSION}" \
--notes "Speculos binary release ${SPECULOS_VERSION}."

- name: Upload release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: speculos-v${{ needs.build.outputs.version }}
run: gh release upload "${RELEASE_TAG}" dist/*.tar.gz --clobber
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
dist/
dist-build/
coverage/

# Logs
Expand Down Expand Up @@ -77,4 +78,7 @@ node_modules/
!.yarn/versions

# Cursor rules
.cursorrules
.cursorrules

# Git worktrees
.worktrees/
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ This repository contains the following packages [^fn1]:
- [`@metamask/eth-simple-keyring`](packages/keyring-eth-simple)
- [`@metamask/eth-snap-keyring`](packages/keyring-snap-bridge)
- [`@metamask/eth-trezor-keyring`](packages/keyring-eth-trezor)
- [`@metamask/hw-emulator`](packages/hw-emulator)
- [`@metamask/hw-wallet-sdk`](packages/hw-wallet-sdk)
- [`@metamask/key-derivation-purposes`](packages/key-derivation-purposes)
- [`@metamask/keyring-api`](packages/keyring-api)
Expand All @@ -36,6 +37,7 @@ This repository contains the following packages [^fn1]:
- [`@metamask/keyring-snap-client`](packages/keyring-snap-client)
- [`@metamask/keyring-snap-sdk`](packages/keyring-snap-sdk)
- [`@metamask/keyring-utils`](packages/keyring-utils)
- [`@metamask/speculos-up`](packages/speculos-up)
- [`@metamask/watch-only-keyring`](packages/keyring-watch-only)

<!-- end package list -->
Expand All @@ -49,6 +51,7 @@ Or, in graph form [^fn1]:
graph LR;
linkStyle default opacity:0.5
account_api(["@metamask/account-api"]);
hw_emulator(["@metamask/hw-emulator"]);
hw_wallet_sdk(["@metamask/hw-wallet-sdk"]);
key_derivation_purposes(["@metamask/key-derivation-purposes"]);
keyring_api(["@metamask/keyring-api"]);
Expand All @@ -67,8 +70,10 @@ linkStyle default opacity:0.5
keyring_snap_sdk(["@metamask/keyring-snap-sdk"]);
keyring_utils(["@metamask/keyring-utils"]);
watch_only_keyring(["@metamask/watch-only-keyring"]);
speculos_up(["@metamask/speculos-up"]);
account_api --> keyring_api;
account_api --> keyring_utils;
hw_emulator --> keyring_eth_qr;
keyring_api --> keyring_utils;
eth_hd_keyring --> keyring_api;
eth_hd_keyring --> keyring_sdk;
Expand Down
4 changes: 4 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const config = createConfig([
'**/dist/**',
'**/docs/**',
'**/coverage/**',
// Archived research spikes — not part of any published package.
'**/spike/**',
// Python virtualenv created by scripts/setup-python.sh.
'**/.venv/**',
],
},

Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,20 @@
"typescript-eslint": "^8.48.0"
},
"resolutions": {
"@types/node": "^20.19.0",
"@types/web": "^0.0.69",
"@typescript/lib-dom": "npm:@types/web@^0.0.69",
"axios@1.7.7": "^1.20.0",
"eslint-import-resolver-typescript": "<=3.7.0",
"eslint-plugin-import-x": "<=4.6.1",
"napi-postinstall": "npm:npm-empty-package@^1.0.0",
"protobufjs@7.4.0": "^7.6.5",
"tar": "^7.5.16",
"tar@^6.1.11": "^7.5.16",
"tar@^6.1.2": "^7.5.16",
"tar@^7.5.4": "^7.5.16",
"tinypool@2.1.0": "^2.2.0",
"uuid@11.0.3": "^11.1.1",
"ws@8.17.1": "^8.22.0"
"ws@8.17.1": "^8.22.0",
"yargs@17.7.2": "^17.7.3"
},
"engines": {
"node": ">=22"
Expand Down
10 changes: 10 additions & 0 deletions packages/hw-emulator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
__pycache__/
*.pyc
*.pyo
.venv/
*.egg-info/
dist/
build/
.pytest_cache/
# Archived research spikes — kept locally, not tracked
spike/
10 changes: 10 additions & 0 deletions packages/hw-emulator/.yarnignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Prevent yarn `file:` packing from copying non-portable / heavy local state
# into consumers' node_modules. The venv is created per-host via
# scripts/setup-python.sh and located at runtime via SPECULOS_BLE_VENV_DIR.
.venv/
coverage/
node_modules/
*.egg-info/
__pycache__/
.tsbuildinfo
*.tsbuildinfo
73 changes: 73 additions & 0 deletions packages/hw-emulator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Added QR hardware wallet emulator (`EmulatorType.Qr`) with UR synthesis, ECDSA signer, BC-UR fountain codec, QR rendering (PNG and Y4M), and QR screenshot decoding ([#560](https://github.com/MetaMask/accounts/pull/560))
- Initial release of `@metamask/hw-emulator` ([#560](https://github.com/MetaMask/accounts/pull/560))
- Hardware wallet emulator lifecycle, transport, and device interaction for E2E testing
- Ledger emulator via Speculos with support for Nano S+, Nano X, Stax, and Flex devices
- Docker and native run modes
- `SpeculosClient` for APDU exchange and screen events
- `ApduBridge` for WebSocket-to-APDU bridge (WebHID mocking)
- `DockerManager` for Docker Compose lifecycle management
- `ProcessManager` for native Speculos process spawning
- Device interaction automation (button presses, touch gestures)
- Resilience utilities (`withRetry`, `ExponentialBackoff`)
- Ledger HID framing session utilities
- WebHID mock script generation for E2E tests
- Deterministic accounts with pre-configured seed
- Bundled ELF app binaries for all supported devices
- Docker Compose configuration for Speculos
- JSDoc documentation on all public types, classes, methods, and constants
- `getElfFilePath` utility for resolving ELF binary paths (native mode)
- `startNative()` defaults to `@metamask/speculos-up` managed binary when no `binary` option is provided
- Fix Docker mode ignoring custom `apduPort` / `apiPort` by passing host ports to `docker-compose`
- Fix Docker mode ignoring the `seed` option by wiring `SPECULOS_SEED` through `docker-compose.yml`
- Fix Docker mode ignoring the `display` option by wiring `SPECULOS_DISPLAY` through `docker-compose.yml`
- Added `@metamask/speculos-up` as peer dependency ([#560](https://github.com/MetaMask/accounts/pull/560))

### Changed

- `SpeculosBleRunner` now honors `SPECULOS_BLE_PACKAGE_DIR` and `SPECULOS_BLE_VENV_DIR` environment variables (mirroring `scripts/setup-python.sh`) so it can locate `python/` and the virtualenv at a stable path even when the package is copied into a consumer's `node_modules` via a Yarn `file:` resolution ([#560](https://github.com/MetaMask/accounts/pull/560))
- `SpeculosBleRunner.start()` now accepts an optional `onLog(line, stream)` callback that receives BLE process stdout/stderr/exit/error output (previously silently discarded) ([#560](https://github.com/MetaMask/accounts/pull/560))
- Merged `@metamask/speculos-ble` package into `@metamask/hw-emulator`. The BLE bridge (Python source, TypeScript `SpeculosBleRunner` wrapper, Docker config) now lives in this package under `python/`, `src/ble/`, and `scripts/` ([#560](https://github.com/MetaMask/accounts/pull/560))

### Fixed

- Native mode now spawns Speculos from the bundled `nvram/` directory so `--load-nvram` finds `main_nvram.bin`, which Speculos resolves relative to the process working directory ([#560](https://github.com/MetaMask/accounts/pull/560))
- Previously the flag was passed with no reachable NVRAM file, which could abort startup under the default `loadNvram: true`. Docker mode is unchanged.
- Pinned `protobuf>=5.26,<7` in the Python BLE bridge dependencies — bumble's `android_netsim` transport imports `google.protobuf` at runtime and `grpcio` does not pull it in transitively, so fresh virtualenvs were missing it at import time ([#560](https://github.com/MetaMask/accounts/pull/560))
- Ledger `Speculos.start()` no longer leaks the process/container when the APDU client fails to connect after startup; `stop()` now cleans up all created resources regardless of the started flag ([#560](https://github.com/MetaMask/accounts/pull/560))
- `ApduBridge` server errors after startup no longer trigger unhandled promise rejections.
- `SpeculosClient.connect()` now enforces a configurable connect timeout instead of hanging indefinitely, and a timed-out exchange can no longer consume a stale late response as its own.
- `DockerManager` tears the container down when the health check fails, uses a per-instance container name so multiple emulators can run concurrently, and honors `stopTimeout` in `docker compose down`.
- `ProcessManager.stop()` is idempotent under concurrent calls (no listener/timer accumulation).
- The WebHID mock script rejects pending exchanges on WebSocket close/error and tolerates non-JSON frames.
- Transaction-signing chunk tracking moved from bridge-global state to per-connection state, fixing corrupted counters with concurrent connections.
- `parseTxPayloadLength` now handles single-byte RLP values correctly.
- Touch-device interactions throw a descriptive error when the device model lacks the required button coordinates, instead of silently doing nothing.
- `SpeculosBleRunner.setupVenv()` uses `execFileSync` (no shell), `stop()` tolerates an already-exited process, and the control-API readiness probe no longer leaks its abort timer.
- Trezor sidecar now tracks and stops the secondary CORS proxy on port 21325 (previously leaked), enforces a 10 MB request-body cap on the proxy (413 beyond), and the asset server rejects path traversal via resolved-path checks ([#560](https://github.com/MetaMask/accounts/pull/560))
- `ControllerClient` no longer leaks pending-request entries on synchronous send failures and routes post-connect socket errors to pending rejections instead of settled promises.
- `TrezorEmulator.start()` stops the Docker container when the controller never becomes available.
- Speculos Docker image pinned to `0.25.13` (was mutable `latest`), and host-side port defaults aligned across `docker-compose.yml` and `scripts/start-android.sh`.
- `scripts/start-android.sh` cleanup now stops and removes the container instead of only killing the Docker CLI process.
- QR screenshot decoding now validates PNG chunk lengths and CRCs and rejects truncated IDAT streams instead of decoding garbage pixels ([#560](https://github.com/MetaMask/accounts/pull/560))
- Y4M rendering survives early ffmpeg exit (EPIPE) without crashing, and failed renders clean up their partial output file.
- `parseXfp` rejects fingerprints that are not exactly 8 hex characters.
- Transaction rejection can target a specific request id so armed rejections cannot be consumed by unrelated requests.
- `renderToPng` throws for multi-fragment URs (use `renderToY4m`), missing derivation paths produce a clear error, and decoding distinguishes completion from success.
- Python BLE bridge hardening ([#560](https://github.com/MetaMask/accounts/pull/560))
- Speculos TCP client enforces a 64 KB max response size; APDU fragmentation rejects payloads over the 16-bit length limit and reassembly detects declared-length overflow.
- Control API validates inputs (`/button/press`, `/error/inject`) and returns 504 instead of an opaque 500 when signing auto-approval times out.
- Error injection is applied atomically under a lock; GATT send failures propagate and reset cancels in-flight exchanges; `device.stop()` is idempotent; dependencies pinned (`bumble==0.0.233`, `aiohttp==3.14.3`, `click==8.4.2`).
- The Trezor sidecar CORS proxy now only accepts origin-form request targets and builds the upstream URL from the configured bridge origin, so a caller-supplied path can no longer redirect the proxy at another host ([#560](https://github.com/MetaMask/accounts/pull/560))

[Unreleased]: https://github.com/MetaMask/accounts/
16 changes: 16 additions & 0 deletions packages/hw-emulator/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.11-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
libusb-1.0-0 \
libbluetooth3 \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY pyproject.toml ./
COPY python/ python/

RUN pip install --no-cache-dir ".[test]"

EXPOSE 9999 5000 5002

CMD ["speculos-ble", "--transport", "vhci", "--verbose"]
21 changes: 21 additions & 0 deletions packages/hw-emulator/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 MetaMask

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading
Loading