Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .github/actions/build-sim/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ runs:
run: |
sudo apt-get update
sudo apt-get install -y gcc-arm-linux-gnueabihf libsdl2-image-dev libslirp-dev libpcsclite-dev ninja-build libltdl-dev
if [[ "${{ inputs.name }}" == onekey* ]]; then
sudo apt-get install -y llvm-dev libclang-dev clang libusb-1.0-0-dev curl libprotobuf-dev git-lfs
fi
pip install poetry uv
wget https://github.com/protocolbuffers/protobuf/releases/download/v22.0/protoc-22.0-linux-x86_64.zip
sudo unzip protoc-22.0-linux-x86_64.zip -d /usr/local
Expand Down Expand Up @@ -50,4 +53,3 @@ runs:
with:
name: ${{ inputs.name }}-sim
path: ${{ inputs.archive }}.tar.gz

16 changes: 16 additions & 0 deletions .github/actions/install-sim/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,19 @@ runs:
apt-get update
apt-get install -y libusb-1.0-0
tar -xvf keepkey-firmware.tar.gz

- if: startsWith(inputs.device, 'onekey')
shell: bash
run: |
apt-get update
apt-get install -y libsdl2-2.0-0 libsdl2-image-2.0-0 libusb-1.0-0
if [ "${{ inputs.device }}" = "onekey-pro" ]; then
# Pro emulator requires a real (virtual) X display — SDL_VIDEODRIVER=dummy
# is not sufficient because the firmware calls SDL_Init(SDL_INIT_VIDEO).
apt-get install -y xvfb
Xvfb :99 -screen 0 1024x768x24 &
echo "DISPLAY=:99" >> "$GITHUB_ENV"
tar -xvf onekey-firmware-pro.tar.gz
else
tar -xvf onekey-firmware-classic1s.tar.gz
fi
4 changes: 4 additions & 0 deletions .github/sim-build-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@
],
"keepkey": [
{ "name": "keepkey", "archive": "keepkey-firmware", "paths": "test/work/keepkey-firmware/bin" }
],
"onekey": [
{ "name": "onekey-pro", "archive": "onekey-firmware-pro", "paths": "test/work/onekey-firmware-pro/core/build/unix test/work/onekey-firmware-pro/core/src" },
{ "name": "onekey-classic1s", "archive": "onekey-firmware-classic1s", "paths": "test/work/onekey-firmware-classic1s/legacy/firmware" }
]
}
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ jobs:
include: ${{ needs.prepare-sim-matrices.outputs.keepkey }}
runs-on: ubuntu-latest

sim-builder-onekey:
name: OneKey sim builder
needs: prepare-sim-matrices
uses: ./.github/workflows/sim-builder.yml
with:
sim: onekey
include: ${{ needs.prepare-sim-matrices.outputs.onekey }}
runs-on: ubuntu-latest

ledger-legacy-app-builder:
name: Ledger Bitcoin Legacy App builder
uses: ./.github/workflows/ledger-legacy-app-builder.yml
Expand Down Expand Up @@ -243,3 +252,18 @@ jobs:
device: keepkey
runs-on: ubuntu-latest

test-onekey-pro:
uses: ./.github/workflows/device-test.yml
needs: [sim-builder-onekey, bitcoind-builder, dist-builder]
with:
device: onekey-pro
runs-on: ubuntu-latest
timeout-minutes: 60

test-onekey-classic1s:
uses: ./.github/workflows/device-test.yml
needs: [sim-builder-onekey, bitcoind-builder, dist-builder]
with:
device: onekey-classic1s
runs-on: ubuntu-latest
timeout-minutes: 60
6 changes: 5 additions & 1 deletion .github/workflows/device-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ on:
required: false
type: string
default: ubuntu-latest
timeout-minutes:
required: false
type: number
default: 45

jobs:
test-device:
name: Python ${{ matrix.python-version }} ${{ matrix.device }} ${{ matrix.test.script || matrix.test.interface }}
runs-on: ${{ inputs.runs-on }}
timeout-minutes: 45
timeout-minutes: ${{ inputs.timeout-minutes }}
strategy:
fail-fast: false
matrix:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/prepare-sim-matrices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ on:
keepkey:
description: JSON include array for keepkey
value: ${{ jobs.prepare.outputs.keepkey }}
onekey:
description: JSON include array for onekey
value: ${{ jobs.prepare.outputs.onekey }}

jobs:
prepare:
Expand All @@ -32,6 +35,7 @@ jobs:
jade: ${{ steps.gen.outputs.jade }}
ledger: ${{ steps.gen.outputs.ledger }}
keepkey: ${{ steps.gen.outputs.keepkey }}
onekey: ${{ steps.gen.outputs.onekey }}
steps:
- uses: actions/checkout@v4
- id: gen
Expand All @@ -40,7 +44,7 @@ jobs:
set -euo pipefail
sudo apt-get install -y jq
map_file=".github/sim-build-map.json"
for sim in trezor coldcard bitbox jade ledger keepkey; do
for sim in trezor coldcard bitbox jade ledger keepkey onekey; do
include=$(jq -c --arg s "$sim" '.[$s]' "$map_file")
if [[ -z "$include" || "$include" == "null" ]]; then
echo "Missing entry for $sim in $map_file" >&2
Expand Down
5 changes: 5 additions & 0 deletions docs/devices/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ The table below lists what devices and features are supported for each device.

\* There are some caveats. See the `sign_tx` for these devices.

OneKey capability behavior depends on device model and firmware.
For locked devices, model-specific unlock instructions are returned in ``enumerate`` warnings.

Support Policy
================

Expand Down Expand Up @@ -98,6 +101,8 @@ Device APIs
:members:
.. automodule:: hwilib.devices.trezor
:members:
.. automodule:: hwilib.devices.onekey
:members:
.. automodule:: hwilib.devices.digitalbitbox
:members:
.. automodule:: hwilib.devices.bitbox02
Expand Down
2 changes: 1 addition & 1 deletion hwilib/_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def get_client_and_device_info(self, index):

self.ui.setpass_button.setEnabled(self.device_info['type'] != 'bitbox02')
self.ui.signmsg_button.setEnabled(True)
self.ui.toggle_passphrase_button.setEnabled(self.device_info['type'] in ('trezor', 'keepkey', 'bitbox02', ))
self.ui.toggle_passphrase_button.setEnabled(self.device_info['type'] in ('trezor', 'onekey', 'keepkey', 'bitbox02', ))

self.get_device_info()

Expand Down
1 change: 1 addition & 0 deletions hwilib/devices/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
__all__ = [
'trezor',
'onekey',
'ledger',
'keepkey',
'digitalbitbox',
Expand Down
Loading