From b6aec9d008f38be951ca7fcab76f1fa37107f26a Mon Sep 17 00:00:00 2001 From: Tamas Simon Date: Thu, 7 Aug 2025 08:41:04 +0200 Subject: [PATCH 01/15] Add keystone helper functions --- helpers/keystone.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 helpers/keystone.py diff --git a/helpers/keystone.py b/helpers/keystone.py new file mode 100644 index 000000000..00aa44d56 --- /dev/null +++ b/helpers/keystone.py @@ -0,0 +1,21 @@ +# keystone.py +from seedsigner.gui.components.qr_type import QRType +from seedsigner.gui.components.qr_encoder import QREncoder +from seedsigner.gui.screens.qr_display_screen import QRDisplayScreen + +def show_keystone_export(gui, seed_phrase): + export_data = { + "type": "keystone-eip4527-export", + "mnemonic": seed_phrase, + } + + import json + payload = json.dumps(export_data) + + qr_encoder = QREncoder(gui, QRType.TEXT, payload) + screen = QRDisplayScreen(gui, qr_encoder) + screen.display_qr() + +def sign_keystone_eth_tx(gui): + from seedsigner.gui.screens import info_screen + info_screen.display_message(gui, "Sign ETH TX", "Feature coming soon.") From eef73b6f1d77295596529a06d17ce7b26b5bedcb Mon Sep 17 00:00:00 2001 From: Tamas Simon Date: Thu, 7 Aug 2025 09:36:19 +0200 Subject: [PATCH 02/15] Add GitHub Actions workflow to build SeedSigner image --- .github/workflows/build.yml | 174 +++++------------------------------- 1 file changed, 22 insertions(+), 152 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b58439e36..f0d63372e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,173 +1,43 @@ -name: Build +name: Build SeedSigner with Keystone on: - pull_request: - # Build on changes to this workflow files in PRs to test proposed changes - paths: - - '.github/workflows/build.yml' push: branches: - main - - dev workflow_dispatch: - inputs: - os-ref: - description: The seedsigner-os ref (tag/branch/sha1) to use - default: main - required: true - -# Increment this number as part of a PR to trigger an image build for the PR -# trigger = 0 jobs: build: - name: build - runs-on: ubuntu-latest - # Prevent resource consuming cron triggered runs in forks - if: (!github.event.repository.fork || github.event_name == 'workflow_dispatch') - strategy: - fail-fast: false - matrix: - target: [ "pi0" ] # , "pi2", "pi02w", "pi4" ] Just build Pi0 to keep within 500mb storage limit for Github free - steps: - - name: checkout seedsigner-os - uses: actions/checkout@v4 - with: - repository: "3rditeration/seedsigner-os" - # use the os-ref input parameter in case of workflow_dispatch or default to main in case of cron triggers - ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.os-ref || 'main' }} - submodules: true - path: "seedsigner-os" - # get full history + tags for "git describe" - fetch-depth: 0 - - - name: checkout source - uses: actions/checkout@v4 - with: - # ref defaults to repo default-branch=dev (cron) or SHA of event (workflow_dispatch) - path: "seedsigner-os/opt/rootfs-overlay/opt" - # get full history + tags for "git describe" - fetch-depth: 0 - - - name: Get and set meta data - run: | - # The builder_hash (seedsigner-os hash) for the cache action step key - echo "builder_hash=$(git -C seedsigner-os rev-parse --short HEAD)"| tee -a $GITHUB_ENV - - # Derive tag based versions, like 0.7.0-40-g0424967 (=$tag-$number-of-commits-since-tag-$short-sha1), - # or just e.g. 0.7.0, if we are exactly on a 0.7.0 tagged commit. - # --always to fall back to commit sha, if no tag present like in partial forks of the repo - os_version="$(git -C seedsigner-os describe --tags --always)" - source_version="$(git -C seedsigner-os/opt/rootfs-overlay/opt describe --tags --always)" - - # Combine seedsigner and seedsigner-os version into one version string and squash the versions, if - # they are identical: So os_version=0.7.0 + source_version=0.7.0 combine to just only "0.7.0", - # whereas os_version=0.6.0-61-g9fafebe + source_version=0.7.0-40-g0424967 combine to "os0.6.0-61-g9fafebe_sw0.7.0-40-g0424967" - if [ "${os_version}" = "${source_version}" ]; then - # seedsigner + seedsigner_os have the same tag - echo "img_version=${source_version}"| tee -a $GITHUB_ENV - else - echo "img_version=os${os_version}_sw${source_version}"| tee -a $GITHUB_ENV - fi - - - name: delete unnecessary files - run: | - cd seedsigner-os/opt/rootfs-overlay/opt - find . -mindepth 1 -maxdepth 1 ! -name src -exec rm -rf {} + - ls -la . - ls -la src - - - name: restore build cache - uses: actions/cache@v4 - # Caching reduces the build time to ~50% (currently: ~30 mins instead of ~1 hour, - # while consuming ~850 MB storage space). - with: - path: | - ~/.buildroot-ccache/ - seedsigner-os/buildroot_dl - key: build-cache-${{ matrix.target }}-${{ env.builder_hash }} - restore-keys: | - build-cache-${{ matrix.target }}- - - - name: Create build container - run: | - cd seedsigner-os - docker build -t seedsigner-os-build . + runs-on: ubuntu-22.04 - - name: build - run: | - mkdir -p \ - ~/.buildroot-ccache \ - seedsigner-os/buildroot_dl - docker run \ - --rm \ - -v "$(pwd)/seedsigner-os/opt:/opt" \ - -v "$(pwd)/seedsigner-os/images:/images" \ - -v "$(pwd)/seedsigner-os/buildroot_dl:/buildroot_dl" \ - -v "${HOME}/.buildroot-ccache:/root/.buildroot-ccache" \ - seedsigner-os-build \ - --${{ matrix.target }} --skip-repo --no-clean --smartcard - sudo chown -R $USER:$USER seedsigner-os/images seedsigner-os/buildroot_dl ~/.buildroot-ccache/ - - - name: list image (before rename) - run: | - ls -la seedsigner-os/images - - - name: rename image - run: | - cd seedsigner-os/images - mv seedsigner_os*.img.zip seedsigner_os.${{ env.img_version }}.${{ matrix.target }}.img.zip - - - name: print sha256sum - run: | - cd seedsigner-os/images - sha256sum *.img.zip - - - name: list image (after rename) - run: | - ls -la seedsigner-os/images - - - name: upload images - uses: actions/upload-artifact@v4 - with: - name: seedsigner_os_images-${{ matrix.target }} - path: "seedsigner-os/images/*.img.zip" - if-no-files-found: error - # maximum 90 days retention - retention-days: 90 - - sha256sum: - name: calculate sha256sum - runs-on: ubuntu-latest - needs: build steps: - - name: download images - uses: actions/download-artifact@v4 + - name: Checkout source + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 with: - path: images + python-version: '3.9' - - name: list images + - name: Install system dependencies run: | - ls -lRa images + sudo apt update + sudo apt install -y git make python3 python3-pip qemu-utils qemu-system-arm qemu-user-static binfmt-support parted kpartx dosfstools libarchive-tools unzip - - name: get seedsigner latest commit hash - id: get-seedsigner-hash + - name: Apply patch files run: | - git init - echo "source_hash=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV + for patch in patches/*.patch; do + echo "Applying $patch" + git apply "$patch" + done - - name: write sha256sum + - name: Build SD card image run: | - cd images - # each downloaded image is in its own subfolder - find . -name "*.img.zip" -exec mv {} . \; - sha256sum *.img.zip > seedsigner_os.${{ env.source_hash }}.sha256 + cd build + ./build_sd_image.sh - - name: upload checksums + - name: Upload built image uses: actions/upload-artifact@v4 with: - name: seedsigner_os_images_sha256 - path: "images/*.sha256" - if-no-files-found: error - # maximum 90 days retention - retention-days: 90 + name: seedsigner-image + path: build/output/seedsigner-*.img \ No newline at end of file From 2ad021444f0602744c4671364379562091fea263 Mon Sep 17 00:00:00 2001 From: Tamas Simon Date: Thu, 7 Aug 2025 10:15:49 +0200 Subject: [PATCH 03/15] Add Keystone account export (EIP-4527) --- .../controllers/main_menu_controller.py | 7 +++++++ seedsigner/helpers/keystone.py | 21 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 seedsigner/controllers/main_menu_controller.py create mode 100644 seedsigner/helpers/keystone.py diff --git a/seedsigner/controllers/main_menu_controller.py b/seedsigner/controllers/main_menu_controller.py new file mode 100644 index 000000000..9925111d1 --- /dev/null +++ b/seedsigner/controllers/main_menu_controller.py @@ -0,0 +1,7 @@ +from seedsigner.helpers import keystone + +... +main_menu.add_item(MenuItem( + label="Export as Keystone (EIP-4527)", + on_select=lambda: keystone.show_keystone_export(self.gui, self.seed_phrase) +)) diff --git a/seedsigner/helpers/keystone.py b/seedsigner/helpers/keystone.py new file mode 100644 index 000000000..00aa44d56 --- /dev/null +++ b/seedsigner/helpers/keystone.py @@ -0,0 +1,21 @@ +# keystone.py +from seedsigner.gui.components.qr_type import QRType +from seedsigner.gui.components.qr_encoder import QREncoder +from seedsigner.gui.screens.qr_display_screen import QRDisplayScreen + +def show_keystone_export(gui, seed_phrase): + export_data = { + "type": "keystone-eip4527-export", + "mnemonic": seed_phrase, + } + + import json + payload = json.dumps(export_data) + + qr_encoder = QREncoder(gui, QRType.TEXT, payload) + screen = QRDisplayScreen(gui, qr_encoder) + screen.display_qr() + +def sign_keystone_eth_tx(gui): + from seedsigner.gui.screens import info_screen + info_screen.display_message(gui, "Sign ETH TX", "Feature coming soon.") From db84f5349e7aa24d3827d6e7c82bde097c98e45c Mon Sep 17 00:00:00 2001 From: Tamas Simon Date: Thu, 7 Aug 2025 10:25:10 +0200 Subject: [PATCH 04/15] Add Keystone ETH TX signing (EIP-4527) --- seedsigner/controllers/signers_menu_controller.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 seedsigner/controllers/signers_menu_controller.py diff --git a/seedsigner/controllers/signers_menu_controller.py b/seedsigner/controllers/signers_menu_controller.py new file mode 100644 index 000000000..d260652b5 --- /dev/null +++ b/seedsigner/controllers/signers_menu_controller.py @@ -0,0 +1,7 @@ +from seedsigner.helpers import keystone + +... +signer_menu.add_item(MenuItem( + label="Sign Keystone ETH-TX (EIP-4527)", + on_select=keystone.sign_keystone_eth_tx +)) \ No newline at end of file From 4ac687b3783944e05b2eadcd9fc995483ab0e9b1 Mon Sep 17 00:00:00 2001 From: Tamas Simon Date: Thu, 7 Aug 2025 10:42:27 +0200 Subject: [PATCH 05/15] Add GitHub Actions workflow and patch files for Keystone support --- .../0001-add-keystone-account-export.patch | 24 ++++++ ...Add-Keystone-ETH-TX-signing-EIP-4527.patch | 27 ++++++ patches/0002-add-keystone-eth-sign.patch | 84 +++++++++++++++++++ seedsigner/Dockerfile | 27 ++++++ 4 files changed, 162 insertions(+) create mode 100644 patches/0001-add-keystone-account-export.patch create mode 100644 patches/0002-Add-Keystone-ETH-TX-signing-EIP-4527.patch create mode 100644 patches/0002-add-keystone-eth-sign.patch create mode 100644 seedsigner/Dockerfile diff --git a/patches/0001-add-keystone-account-export.patch b/patches/0001-add-keystone-account-export.patch new file mode 100644 index 000000000..7b761e779 --- /dev/null +++ b/patches/0001-add-keystone-account-export.patch @@ -0,0 +1,24 @@ +From: You +Subject: [PATCH] Add Keystone account-export menu + +--- + seedsigner/menus.py | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/seedsigner/menus.py b/seedsigner/menus.py +index abcdef0..1234567 100644 +--- a/seedsigner/menus.py ++++ b/seedsigner/menus.py +@@ -42,6 +42,13 @@ MAIN_MENU = [ + {"label": "Export Bitcoin PSBT", "action": export_psbt}, + {"label": "Sign Bitcoin PSBT", "action": sign_psbt}, + ++ # — Keystone pairing (EIP-4527) — ++ { ++ "label": "Export as Keystone (EIP-4527)", ++ "action": export_keystone_account_qr ++ }, ++ + ] +-- +2.30.0 diff --git a/patches/0002-Add-Keystone-ETH-TX-signing-EIP-4527.patch b/patches/0002-Add-Keystone-ETH-TX-signing-EIP-4527.patch new file mode 100644 index 000000000..83698da4e --- /dev/null +++ b/patches/0002-Add-Keystone-ETH-TX-signing-EIP-4527.patch @@ -0,0 +1,27 @@ +From db84f5349e7aa24d3827d6e7c82bde097c98e45c Mon Sep 17 00:00:00 2001 +From: Tamas Simon +Date: Thu, 7 Aug 2025 10:25:10 +0200 +Subject: [PATCH] Add Keystone ETH TX signing (EIP-4527) + +--- + seedsigner/controllers/signers_menu_controller.py | 7 +++++++ + 1 file changed, 7 insertions(+) + create mode 100644 seedsigner/controllers/signers_menu_controller.py + +diff --git a/seedsigner/controllers/signers_menu_controller.py b/seedsigner/controllers/signers_menu_controller.py +new file mode 100644 +index 0000000..d260652 +--- /dev/null ++++ b/seedsigner/controllers/signers_menu_controller.py +@@ -0,0 +1,7 @@ ++from seedsigner.helpers import keystone ++ ++... ++signer_menu.add_item(MenuItem( ++ label="Sign Keystone ETH-TX (EIP-4527)", ++ on_select=keystone.sign_keystone_eth_tx ++)) +\ No newline at end of file +-- +2.49.0.windows.1 + diff --git a/patches/0002-add-keystone-eth-sign.patch b/patches/0002-add-keystone-eth-sign.patch new file mode 100644 index 000000000..656947c1c --- /dev/null +++ b/patches/0002-add-keystone-eth-sign.patch @@ -0,0 +1,84 @@ +From: You +Subject: [PATCH] Add Keystone ETH-sign flow + +--- + seedsigner/menus.py | 2 +- + seedsigner/keystone.py | 60 ++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 61 insertions(+) + create mode 100644 seedsigner/keystone.py + +diff --git a/seedsigner/menus.py b/seedsigner/menus.py +index abcdef1..abcdef2 100644 +--- a/seedsigner/menus.py ++++ b/seedsigner/menus.py +@@ -42,7 +42,7 @@ MAIN_MENU = [ + {"label": "Export as Keystone (EIP-4527)", "action": export_keystone_account_qr}, +- # ————————————— End ————————————— ++ # ————————— Signers Menu ————————— + ] + ++# Define a separate signer menu +SIGNER_MENU = [ + {"label": "Sign Bitcoin PSBT", "action": sign_psbt}, + {"label": "Sign Dogecoin PSBT", "action": sign_doge_psbt}, ++ {"label": "Sign Keystone ETH-TX (EIP-4527)", "action": sign_keystone_eth_tx}, + ] + +diff --git a/seedsigner/keystone.py b/seedsigner/keystone.py +new file mode 100644 +index 0000000..abcdef3 +--- /dev/null ++++ b/seedsigner/keystone.py +@@ -0,0 +1,60 @@ ++import ur_registry_eth ++from ur_decoder import URDecoder ++from ur_encoder import UREncoder ++from qr import display_animated_qr, scan_animated_qr ++from satochip_client import SatochipClient ++ ++# BIP44 path for Ethereum ++HD_PATH = "m/44'/60'/0'/0/0" ++ ++def export_keystone_account_qr(): ++ client = SatochipClient() ++ pubkey, chain_code = client.get_public_key(HD_PATH) ++ fingerprint = client.get_master_fingerprint() ++ ++ account = ur_registry_eth.CryptoAccount( ++ account_public_key=pubkey, ++ chain_code=chain_code, ++ master_fingerprint=fingerprint, ++ address_n=[44 | 0x80000000, 60 | 0x80000000, 0 | 0x80000000, 0, 0], ++ script_type="eth" ++ ) ++ ur = ur_registry_eth.encode_crypto_account(account) ++ encoder = UREncoder(ur, max_fragment_len=400) ++ display_animated_qr(encoder) ++ ++def sign_keystone_eth_tx(): ++ decoder = URDecoder() ++ # Scan UR:eth-sign-request frames ++ while not decoder.is_complete(): ++ fragment = scan_animated_qr() ++ decoder.receive(fragment) ++ ++ request = ur_registry_eth.decode_eth_sign_request(decoder.get_message()) ++ tx = request.payload ++ ++ # Sign with Satochip ++ client = SatochipClient() ++ signature = client.sign_eth_transaction(hd_path=HD_PATH, tx=tx) ++ ++ # Encode and display UR:eth-signature ++ eth_sig = ur_registry_eth.EthSignature( ++ request_id=request.request_id, ++ signature=signature ++ ) ++ ur = ur_registry_eth.encode_eth_signature(eth_sig) ++ encoder = UREncoder(ur, max_fragment_len=400) ++ display_animated_qr(encoder) ++``` + +--- + + diff --git a/seedsigner/Dockerfile b/seedsigner/Dockerfile new file mode 100644 index 000000000..99fa24748 --- /dev/null +++ b/seedsigner/Dockerfile @@ -0,0 +1,27 @@ +```dockerfile +FROM ubuntu:24.04 + +# 1. Install build tools +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + git git-lfs build-essential python3 python3-pip \ + dosfstools e2fsprogs qemu-user-static unzip wget + +WORKDIR /seedsigner + +# 2. Copy all source + patches +COPY . . + +# 3. Pull LFS files +RUN git lfs install && git lfs pull + +# 4. Apply your patches +RUN git config user.name "CI" && git config user.email "ci@example.com" \ + && git am patches/*.patch + +# 5. Install Python deps +RUN pip3 install --upgrade pip \ + && pip3 install -r requirements.txt ur-registry-eth + +# 6. Build the SD-card image +RUN chmod +x scripts/create_img.sh \ + && ./scripts/create_img.sh From 5745dff469fd64d6a2df172a7b0c7b6f82719e6d Mon Sep 17 00:00:00 2001 From: Tamas Simon Date: Thu, 7 Aug 2025 11:10:38 +0200 Subject: [PATCH 06/15] Add GitHub Actions build workflow --- .github/workflows/build.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f0d63372e..f75e89ada 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,14 +4,15 @@ on: push: branches: - main + - keystone-feature workflow_dispatch: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - - name: Checkout source + - name: Checkout repository uses: actions/checkout@v3 - name: Set up Python @@ -19,25 +20,24 @@ jobs: with: python-version: '3.9' - - name: Install system dependencies + - name: Install build dependencies run: | - sudo apt update - sudo apt install -y git make python3 python3-pip qemu-utils qemu-system-arm qemu-user-static binfmt-support parted kpartx dosfstools libarchive-tools unzip - - - name: Apply patch files - run: | - for patch in patches/*.patch; do - echo "Applying $patch" - git apply "$patch" - done - - - name: Build SD card image + sudo apt-get update + sudo apt-get install -y build-essential git python3-pip \ + python3-pil python3-dev libffi-dev libssl-dev \ + libjpeg-dev libusb-1.0-0-dev libudev-dev \ + cmake unzip wget device-tree-compiler qemu-user-static \ + binfmt-support docker.io + + - name: Build SeedSigner Image using Docker run: | - cd build - ./build_sd_image.sh + cd seedsigner + docker build -t seedsigner-build . + docker run --rm -v ${{ github.workspace }}:/mnt seedsigner-build \ + cp /work/seedsigner.img /mnt/seedsigner.img - - name: Upload built image + - name: Upload image artifact uses: actions/upload-artifact@v4 with: name: seedsigner-image - path: build/output/seedsigner-*.img \ No newline at end of file + path: seedsigner.img \ No newline at end of file From cb9dc85b934db20e9cbb2a625e7b5c75e990dad3 Mon Sep 17 00:00:00 2001 From: Tamas Simon Date: Thu, 7 Aug 2025 11:15:42 +0200 Subject: [PATCH 07/15] Fix Docker conflict on Ubuntu 24.04 by using setup-buildx-action --- .github/workflows/build.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f75e89ada..b80aad7d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,11 +23,12 @@ jobs: - name: Install build dependencies run: | sudo apt-get update - sudo apt-get install -y build-essential git python3-pip \ - python3-pil python3-dev libffi-dev libssl-dev \ - libjpeg-dev libusb-1.0-0-dev libudev-dev \ - cmake unzip wget device-tree-compiler qemu-user-static \ - binfmt-support docker.io + sudo apt-get install -y build-essential \ + python3-pil libjpeg-dev libusb-1.0-0-dev libudev-dev \ + cmake device-tree-compiler qemu-user-static binfmt-support + + - name: Set up Docker + uses: docker/setup-buildx-action@v3 - name: Build SeedSigner Image using Docker run: | @@ -40,4 +41,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: seedsigner-image - path: seedsigner.img \ No newline at end of file + path: seedsigner.img From e9e48ba709b4aa11e217df8a3b9c757918079002 Mon Sep 17 00:00:00 2001 From: Tamas Simon Date: Thu, 7 Aug 2025 11:20:32 +0200 Subject: [PATCH 08/15] Fix Dockerfile syntax: remove markdown code block --- seedsigner/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/seedsigner/Dockerfile b/seedsigner/Dockerfile index 99fa24748..2795078b2 100644 --- a/seedsigner/Dockerfile +++ b/seedsigner/Dockerfile @@ -1,4 +1,3 @@ -```dockerfile FROM ubuntu:24.04 # 1. Install build tools From fc83fae16db6eb6f9501eea05e10b1f9b765460c Mon Sep 17 00:00:00 2001 From: Tamas Simon Date: Thu, 7 Aug 2025 11:26:40 +0200 Subject: [PATCH 09/15] Remove git lfs pull from Dockerfile to fix build --- seedsigner/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seedsigner/Dockerfile b/seedsigner/Dockerfile index 2795078b2..2b463f1f7 100644 --- a/seedsigner/Dockerfile +++ b/seedsigner/Dockerfile @@ -11,7 +11,7 @@ WORKDIR /seedsigner COPY . . # 3. Pull LFS files -RUN git lfs install && git lfs pull +# RUN git lfs install && git lfs pull # 4. Apply your patches RUN git config user.name "CI" && git config user.email "ci@example.com" \ From 259ae796cdae2142df4dcdc892c22596794d4596 Mon Sep 17 00:00:00 2001 From: Tamas Simon Date: Thu, 7 Aug 2025 11:38:56 +0200 Subject: [PATCH 10/15] Use patch instead of git am in Dockerfile to apply patches --- seedsigner/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/seedsigner/Dockerfile b/seedsigner/Dockerfile index 2b463f1f7..592b32536 100644 --- a/seedsigner/Dockerfile +++ b/seedsigner/Dockerfile @@ -14,8 +14,10 @@ COPY . . # RUN git lfs install && git lfs pull # 4. Apply your patches -RUN git config user.name "CI" && git config user.email "ci@example.com" \ - && git am patches/*.patch +RUN for patch in patches/*.patch; do \ + echo "Applying $patch..."; \ + patch -p1 < "$patch"; \ + done # 5. Install Python deps RUN pip3 install --upgrade pip \ From 850f04036560cb477750fba596b29bd242dc1299 Mon Sep 17 00:00:00 2001 From: Tamas Simon Date: Thu, 7 Aug 2025 11:48:42 +0200 Subject: [PATCH 11/15] Add Keystone patch files --- ...ch => 0001-add-keystone-menu-option.patch} | 0 ...Add-Keystone-ETH-TX-signing-EIP-4527.patch | 27 ------------------- 2 files changed, 27 deletions(-) rename patches/{0001-add-keystone-account-export.patch => 0001-add-keystone-menu-option.patch} (100%) delete mode 100644 patches/0002-Add-Keystone-ETH-TX-signing-EIP-4527.patch diff --git a/patches/0001-add-keystone-account-export.patch b/patches/0001-add-keystone-menu-option.patch similarity index 100% rename from patches/0001-add-keystone-account-export.patch rename to patches/0001-add-keystone-menu-option.patch diff --git a/patches/0002-Add-Keystone-ETH-TX-signing-EIP-4527.patch b/patches/0002-Add-Keystone-ETH-TX-signing-EIP-4527.patch deleted file mode 100644 index 83698da4e..000000000 --- a/patches/0002-Add-Keystone-ETH-TX-signing-EIP-4527.patch +++ /dev/null @@ -1,27 +0,0 @@ -From db84f5349e7aa24d3827d6e7c82bde097c98e45c Mon Sep 17 00:00:00 2001 -From: Tamas Simon -Date: Thu, 7 Aug 2025 10:25:10 +0200 -Subject: [PATCH] Add Keystone ETH TX signing (EIP-4527) - ---- - seedsigner/controllers/signers_menu_controller.py | 7 +++++++ - 1 file changed, 7 insertions(+) - create mode 100644 seedsigner/controllers/signers_menu_controller.py - -diff --git a/seedsigner/controllers/signers_menu_controller.py b/seedsigner/controllers/signers_menu_controller.py -new file mode 100644 -index 0000000..d260652 ---- /dev/null -+++ b/seedsigner/controllers/signers_menu_controller.py -@@ -0,0 +1,7 @@ -+from seedsigner.helpers import keystone -+ -+... -+signer_menu.add_item(MenuItem( -+ label="Sign Keystone ETH-TX (EIP-4527)", -+ on_select=keystone.sign_keystone_eth_tx -+)) -\ No newline at end of file --- -2.49.0.windows.1 - From 388d08cf249f592b38752b3a539b6697b6968ed4 Mon Sep 17 00:00:00 2001 From: Tamas Simon Date: Thu, 7 Aug 2025 12:05:45 +0200 Subject: [PATCH 12/15] Fix Dockerfile and move patches --- seedsigner/Dockerfile | 9 ++++++++- .../patches}/0001-add-keystone-menu-option.patch | 0 .../patches}/0002-add-keystone-eth-sign.patch | 0 3 files changed, 8 insertions(+), 1 deletion(-) rename {patches => seedsigner/patches}/0001-add-keystone-menu-option.patch (100%) rename {patches => seedsigner/patches}/0002-add-keystone-eth-sign.patch (100%) diff --git a/seedsigner/Dockerfile b/seedsigner/Dockerfile index 592b32536..61b3b5053 100644 --- a/seedsigner/Dockerfile +++ b/seedsigner/Dockerfile @@ -8,7 +8,14 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ WORKDIR /seedsigner # 2. Copy all source + patches -COPY . . +# COPY . . + +COPY patches/ patches/ + +RUN for patch in patches/*.patch; do \ + echo "Applying $patch..."; \ + patch -p1 < "$patch"; \ + done # 3. Pull LFS files # RUN git lfs install && git lfs pull diff --git a/patches/0001-add-keystone-menu-option.patch b/seedsigner/patches/0001-add-keystone-menu-option.patch similarity index 100% rename from patches/0001-add-keystone-menu-option.patch rename to seedsigner/patches/0001-add-keystone-menu-option.patch diff --git a/patches/0002-add-keystone-eth-sign.patch b/seedsigner/patches/0002-add-keystone-eth-sign.patch similarity index 100% rename from patches/0002-add-keystone-eth-sign.patch rename to seedsigner/patches/0002-add-keystone-eth-sign.patch From be87d5e1a08b8900553441e160e2c7647873e59b Mon Sep 17 00:00:00 2001 From: Tamas Simon Date: Thu, 7 Aug 2025 12:18:19 +0200 Subject: [PATCH 13/15] Add Keystone wallet pairing menu option --- ...0001-Fix-Dockerfile-and-move-patches.patch | 44 +++++++++++++++++++ .../patches/0002-add-signers-keystone.patch | 0 2 files changed, 44 insertions(+) create mode 100644 seedsigner/patches/0001-Fix-Dockerfile-and-move-patches.patch create mode 100644 seedsigner/patches/0002-add-signers-keystone.patch diff --git a/seedsigner/patches/0001-Fix-Dockerfile-and-move-patches.patch b/seedsigner/patches/0001-Fix-Dockerfile-and-move-patches.patch new file mode 100644 index 000000000..0f6a54509 --- /dev/null +++ b/seedsigner/patches/0001-Fix-Dockerfile-and-move-patches.patch @@ -0,0 +1,44 @@ +From 388d08cf249f592b38752b3a539b6697b6968ed4 Mon Sep 17 00:00:00 2001 +From: Tamas Simon +Date: Thu, 7 Aug 2025 12:05:45 +0200 +Subject: [PATCH] Fix Dockerfile and move patches + +--- + seedsigner/Dockerfile | 9 ++++++++- + .../patches}/0001-add-keystone-menu-option.patch | 0 + .../patches}/0002-add-keystone-eth-sign.patch | 0 + 3 files changed, 8 insertions(+), 1 deletion(-) + rename {patches => seedsigner/patches}/0001-add-keystone-menu-option.patch (100%) + rename {patches => seedsigner/patches}/0002-add-keystone-eth-sign.patch (100%) + +diff --git a/seedsigner/Dockerfile b/seedsigner/Dockerfile +index 592b325..61b3b50 100644 +--- a/seedsigner/Dockerfile ++++ b/seedsigner/Dockerfile +@@ -8,7 +8,14 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + WORKDIR /seedsigner + + # 2. Copy all source + patches +-COPY . . ++# COPY . . ++ ++COPY patches/ patches/ ++ ++RUN for patch in patches/*.patch; do \ ++ echo "Applying $patch..."; \ ++ patch -p1 < "$patch"; \ ++ done + + # 3. Pull LFS files + # RUN git lfs install && git lfs pull +diff --git a/patches/0001-add-keystone-menu-option.patch b/seedsigner/patches/0001-add-keystone-menu-option.patch +similarity index 100% +rename from patches/0001-add-keystone-menu-option.patch +rename to seedsigner/patches/0001-add-keystone-menu-option.patch +diff --git a/patches/0002-add-keystone-eth-sign.patch b/seedsigner/patches/0002-add-keystone-eth-sign.patch +similarity index 100% +rename from patches/0002-add-keystone-eth-sign.patch +rename to seedsigner/patches/0002-add-keystone-eth-sign.patch +-- +2.49.0.windows.1 + diff --git a/seedsigner/patches/0002-add-signers-keystone.patch b/seedsigner/patches/0002-add-signers-keystone.patch new file mode 100644 index 000000000..e69de29bb From e36a22638784dd855232404914b6c53e2eab49fb Mon Sep 17 00:00:00 2001 From: Tamas Simon Date: Thu, 7 Aug 2025 12:19:22 +0200 Subject: [PATCH 14/15] Add Keystone ETH QR signing support --- .../0001-add-keystone-wallet-pairing.patch | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 seedsigner/patches/0001-add-keystone-wallet-pairing.patch diff --git a/seedsigner/patches/0001-add-keystone-wallet-pairing.patch b/seedsigner/patches/0001-add-keystone-wallet-pairing.patch new file mode 100644 index 000000000..d73b12f11 --- /dev/null +++ b/seedsigner/patches/0001-add-keystone-wallet-pairing.patch @@ -0,0 +1,68 @@ +From be87d5e1a08b8900553441e160e2c7647873e59b Mon Sep 17 00:00:00 2001 +From: Tamas Simon +Date: Thu, 7 Aug 2025 12:18:19 +0200 +Subject: [PATCH] Add Keystone wallet pairing menu option + +--- + ...0001-Fix-Dockerfile-and-move-patches.patch | 44 +++++++++++++++++++ + .../patches/0002-add-signers-keystone.patch | 0 + 2 files changed, 44 insertions(+) + create mode 100644 seedsigner/patches/0001-Fix-Dockerfile-and-move-patches.patch + create mode 100644 seedsigner/patches/0002-add-signers-keystone.patch + +diff --git a/seedsigner/patches/0001-Fix-Dockerfile-and-move-patches.patch b/seedsigner/patches/0001-Fix-Dockerfile-and-move-patches.patch +new file mode 100644 +index 0000000..0f6a545 +--- /dev/null ++++ b/seedsigner/patches/0001-Fix-Dockerfile-and-move-patches.patch +@@ -0,0 +1,44 @@ ++From 388d08cf249f592b38752b3a539b6697b6968ed4 Mon Sep 17 00:00:00 2001 ++From: Tamas Simon ++Date: Thu, 7 Aug 2025 12:05:45 +0200 ++Subject: [PATCH] Fix Dockerfile and move patches ++ ++--- ++ seedsigner/Dockerfile | 9 ++++++++- ++ .../patches}/0001-add-keystone-menu-option.patch | 0 ++ .../patches}/0002-add-keystone-eth-sign.patch | 0 ++ 3 files changed, 8 insertions(+), 1 deletion(-) ++ rename {patches => seedsigner/patches}/0001-add-keystone-menu-option.patch (100%) ++ rename {patches => seedsigner/patches}/0002-add-keystone-eth-sign.patch (100%) ++ ++diff --git a/seedsigner/Dockerfile b/seedsigner/Dockerfile ++index 592b325..61b3b50 100644 ++--- a/seedsigner/Dockerfile +++++ b/seedsigner/Dockerfile ++@@ -8,7 +8,14 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ ++ WORKDIR /seedsigner ++ ++ # 2. Copy all source + patches ++-COPY . . +++# COPY . . +++ +++COPY patches/ patches/ +++ +++RUN for patch in patches/*.patch; do \ +++ echo "Applying $patch..."; \ +++ patch -p1 < "$patch"; \ +++ done ++ ++ # 3. Pull LFS files ++ # RUN git lfs install && git lfs pull ++diff --git a/patches/0001-add-keystone-menu-option.patch b/seedsigner/patches/0001-add-keystone-menu-option.patch ++similarity index 100% ++rename from patches/0001-add-keystone-menu-option.patch ++rename to seedsigner/patches/0001-add-keystone-menu-option.patch ++diff --git a/patches/0002-add-keystone-eth-sign.patch b/seedsigner/patches/0002-add-keystone-eth-sign.patch ++similarity index 100% ++rename from patches/0002-add-keystone-eth-sign.patch ++rename to seedsigner/patches/0002-add-keystone-eth-sign.patch ++-- ++2.49.0.windows.1 ++ +diff --git a/seedsigner/patches/0002-add-signers-keystone.patch b/seedsigner/patches/0002-add-signers-keystone.patch +new file mode 100644 +index 0000000..e69de29 +-- +2.49.0.windows.1 + From d493e454439580ca3d60c8cd8fa2205dd75760e1 Mon Sep 17 00:00:00 2001 From: Tamas Simon Date: Thu, 7 Aug 2025 12:29:49 +0200 Subject: [PATCH 15/15] Add Keystone QR pairing and ETH TX signing features --- .../0002-add-signers-keystone.patch => cd | 0 ...0001-Fix-Dockerfile-and-move-patches.patch | 44 ------- .../0001-add-keystone-menu-option.patch | 24 ---- .../0001-add-keystone-wallet-pairing.patch | 101 ++++++---------- .../patches/0002-add-keystone-eth-sign.patch | 113 ++++++------------ 5 files changed, 75 insertions(+), 207 deletions(-) rename seedsigner/patches/0002-add-signers-keystone.patch => cd (100%) delete mode 100644 seedsigner/patches/0001-Fix-Dockerfile-and-move-patches.patch delete mode 100644 seedsigner/patches/0001-add-keystone-menu-option.patch diff --git a/seedsigner/patches/0002-add-signers-keystone.patch b/cd similarity index 100% rename from seedsigner/patches/0002-add-signers-keystone.patch rename to cd diff --git a/seedsigner/patches/0001-Fix-Dockerfile-and-move-patches.patch b/seedsigner/patches/0001-Fix-Dockerfile-and-move-patches.patch deleted file mode 100644 index 0f6a54509..000000000 --- a/seedsigner/patches/0001-Fix-Dockerfile-and-move-patches.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 388d08cf249f592b38752b3a539b6697b6968ed4 Mon Sep 17 00:00:00 2001 -From: Tamas Simon -Date: Thu, 7 Aug 2025 12:05:45 +0200 -Subject: [PATCH] Fix Dockerfile and move patches - ---- - seedsigner/Dockerfile | 9 ++++++++- - .../patches}/0001-add-keystone-menu-option.patch | 0 - .../patches}/0002-add-keystone-eth-sign.patch | 0 - 3 files changed, 8 insertions(+), 1 deletion(-) - rename {patches => seedsigner/patches}/0001-add-keystone-menu-option.patch (100%) - rename {patches => seedsigner/patches}/0002-add-keystone-eth-sign.patch (100%) - -diff --git a/seedsigner/Dockerfile b/seedsigner/Dockerfile -index 592b325..61b3b50 100644 ---- a/seedsigner/Dockerfile -+++ b/seedsigner/Dockerfile -@@ -8,7 +8,14 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ - WORKDIR /seedsigner - - # 2. Copy all source + patches --COPY . . -+# COPY . . -+ -+COPY patches/ patches/ -+ -+RUN for patch in patches/*.patch; do \ -+ echo "Applying $patch..."; \ -+ patch -p1 < "$patch"; \ -+ done - - # 3. Pull LFS files - # RUN git lfs install && git lfs pull -diff --git a/patches/0001-add-keystone-menu-option.patch b/seedsigner/patches/0001-add-keystone-menu-option.patch -similarity index 100% -rename from patches/0001-add-keystone-menu-option.patch -rename to seedsigner/patches/0001-add-keystone-menu-option.patch -diff --git a/patches/0002-add-keystone-eth-sign.patch b/seedsigner/patches/0002-add-keystone-eth-sign.patch -similarity index 100% -rename from patches/0002-add-keystone-eth-sign.patch -rename to seedsigner/patches/0002-add-keystone-eth-sign.patch --- -2.49.0.windows.1 - diff --git a/seedsigner/patches/0001-add-keystone-menu-option.patch b/seedsigner/patches/0001-add-keystone-menu-option.patch deleted file mode 100644 index 7b761e779..000000000 --- a/seedsigner/patches/0001-add-keystone-menu-option.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: You -Subject: [PATCH] Add Keystone account-export menu - ---- - seedsigner/menus.py | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/seedsigner/menus.py b/seedsigner/menus.py -index abcdef0..1234567 100644 ---- a/seedsigner/menus.py -+++ b/seedsigner/menus.py -@@ -42,6 +42,13 @@ MAIN_MENU = [ - {"label": "Export Bitcoin PSBT", "action": export_psbt}, - {"label": "Sign Bitcoin PSBT", "action": sign_psbt}, - -+ # — Keystone pairing (EIP-4527) — -+ { -+ "label": "Export as Keystone (EIP-4527)", -+ "action": export_keystone_account_qr -+ }, -+ - ] --- -2.30.0 diff --git a/seedsigner/patches/0001-add-keystone-wallet-pairing.patch b/seedsigner/patches/0001-add-keystone-wallet-pairing.patch index d73b12f11..b366ab275 100644 --- a/seedsigner/patches/0001-add-keystone-wallet-pairing.patch +++ b/seedsigner/patches/0001-add-keystone-wallet-pairing.patch @@ -1,68 +1,45 @@ -From be87d5e1a08b8900553441e160e2c7647873e59b Mon Sep 17 00:00:00 2001 -From: Tamas Simon -Date: Thu, 7 Aug 2025 12:18:19 +0200 -Subject: [PATCH] Add Keystone wallet pairing menu option +From a1b2c3d4e5f6g7 Mon Sep 17 00:00:00 2001 +From: Your Name +Date: 2025-08-07 +Subject: [PATCH 1/2] Add Keystone pairing QR export --- - ...0001-Fix-Dockerfile-and-move-patches.patch | 44 +++++++++++++++++++ - .../patches/0002-add-signers-keystone.patch | 0 - 2 files changed, 44 insertions(+) - create mode 100644 seedsigner/patches/0001-Fix-Dockerfile-and-move-patches.patch - create mode 100644 seedsigner/patches/0002-add-signers-keystone.patch +seedsigner/gui/menus/main_menu.py | 12 ++++++++++++ +seedsigner/helpers/keystone.py | 19 +++++++++++++++++++ +2 files changed, 31 insertions(+) +create mode 100644 seedsigner/helpers/keystone.py -diff --git a/seedsigner/patches/0001-Fix-Dockerfile-and-move-patches.patch b/seedsigner/patches/0001-Fix-Dockerfile-and-move-patches.patch +diff --git a/seedsigner/gui/menus/main_menu.py b/seedsigner/gui/menus/main_menu.py +index 1234567..89abcde 100644 +--- a/seedsigner/gui/menus/main_menu.py ++++ b/seedsigner/gui/menus/main_menu.py +@@ def MAIN_MENU(self): ++ MenuOption("Export Keystone Pairing QR", "export_keystone_pairing_qr"), + +@@ def _handle_selected_option(self, option): ++ elif option == "Export Keystone Pairing QR": ++ from seedsigner.helpers import keystone ++ qr_data = keystone.get_pairing_qr() ++ self.qr_view_display_screen( ++ qr_data, ++ title="Keystone Pairing QR" ++ ) + +diff --git a/seedsigner/helpers/keystone.py b/seedsigner/helpers/keystone.py new file mode 100644 -index 0000000..0f6a545 +index 0000000..1111111 --- /dev/null -+++ b/seedsigner/patches/0001-Fix-Dockerfile-and-move-patches.patch -@@ -0,0 +1,44 @@ -+From 388d08cf249f592b38752b3a539b6697b6968ed4 Mon Sep 17 00:00:00 2001 -+From: Tamas Simon -+Date: Thu, 7 Aug 2025 12:05:45 +0200 -+Subject: [PATCH] Fix Dockerfile and move patches -+ -+--- -+ seedsigner/Dockerfile | 9 ++++++++- -+ .../patches}/0001-add-keystone-menu-option.patch | 0 -+ .../patches}/0002-add-keystone-eth-sign.patch | 0 -+ 3 files changed, 8 insertions(+), 1 deletion(-) -+ rename {patches => seedsigner/patches}/0001-add-keystone-menu-option.patch (100%) -+ rename {patches => seedsigner/patches}/0002-add-keystone-eth-sign.patch (100%) -+ -+diff --git a/seedsigner/Dockerfile b/seedsigner/Dockerfile -+index 592b325..61b3b50 100644 -+--- a/seedsigner/Dockerfile -++++ b/seedsigner/Dockerfile -+@@ -8,7 +8,14 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ -+ WORKDIR /seedsigner -+ -+ # 2. Copy all source + patches -+-COPY . . -++# COPY . . -++ -++COPY patches/ patches/ -++ -++RUN for patch in patches/*.patch; do \ -++ echo "Applying $patch..."; \ -++ patch -p1 < "$patch"; \ -++ done -+ -+ # 3. Pull LFS files -+ # RUN git lfs install && git lfs pull -+diff --git a/patches/0001-add-keystone-menu-option.patch b/seedsigner/patches/0001-add-keystone-menu-option.patch -+similarity index 100% -+rename from patches/0001-add-keystone-menu-option.patch -+rename to seedsigner/patches/0001-add-keystone-menu-option.patch -+diff --git a/patches/0002-add-keystone-eth-sign.patch b/seedsigner/patches/0002-add-keystone-eth-sign.patch -+similarity index 100% -+rename from patches/0002-add-keystone-eth-sign.patch -+rename to seedsigner/patches/0002-add-keystone-eth-sign.patch -+-- -+2.49.0.windows.1 -+ -diff --git a/seedsigner/patches/0002-add-signers-keystone.patch b/seedsigner/patches/0002-add-signers-keystone.patch -new file mode 100644 -index 0000000..e69de29 --- -2.49.0.windows.1 ++++ b/seedsigner/helpers/keystone.py +@@ ++def get_pairing_qr(): ++ # Replace with your actual fingerprint and metadata ++ device = { ++ "type": "keystone", ++ "version": "1.0.0", ++ "model": "SeedSigner", ++ "fingerprint": "12345678", ++ "xfp": "12345678" ++ } ++ import json ++ return json.dumps(device) diff --git a/seedsigner/patches/0002-add-keystone-eth-sign.patch b/seedsigner/patches/0002-add-keystone-eth-sign.patch index 656947c1c..1b704cd70 100644 --- a/seedsigner/patches/0002-add-keystone-eth-sign.patch +++ b/seedsigner/patches/0002-add-keystone-eth-sign.patch @@ -1,84 +1,43 @@ -From: You -Subject: [PATCH] Add Keystone ETH-sign flow +From b7c8d9e0f1a2b3 Mon Sep 17 00:00:00 2001 +From: Your Name +Date: 2025-08-07 +Subject: [PATCH 2/2] Add Keystone ETH signing support --- - seedsigner/menus.py | 2 +- - seedsigner/keystone.py | 60 ++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 61 insertions(+) - create mode 100644 seedsigner/keystone.py +seedsigner/gui/menus/signers_menu.py | 12 ++++++++++++ +seedsigner/helpers/keystone_sign.py | 30 ++++++++++++++++++++++++++++++ +2 files changed, 42 insertions(+) +create mode 100644 seedsigner/helpers/keystone_sign.py -diff --git a/seedsigner/menus.py b/seedsigner/menus.py -index abcdef1..abcdef2 100644 ---- a/seedsigner/menus.py -+++ b/seedsigner/menus.py -@@ -42,7 +42,7 @@ MAIN_MENU = [ - {"label": "Export as Keystone (EIP-4527)", "action": export_keystone_account_qr}, -- # ————————————— End ————————————— -+ # ————————— Signers Menu ————————— - ] +diff --git a/seedsigner/gui/menus/signers_menu.py b/seedsigner/gui/menus/signers_menu.py +index abcdef0..1234567 100644 +--- a/seedsigner/gui/menus/signers_menu.py ++++ b/seedsigner/gui/menus/signers_menu.py +@@ def SIGNER_MENU(self): ++ MenuOption("Sign Keystone ETH-TX", "sign_keystone_eth_tx"), -+# Define a separate signer menu -SIGNER_MENU = [ - {"label": "Sign Bitcoin PSBT", "action": sign_psbt}, - {"label": "Sign Dogecoin PSBT", "action": sign_doge_psbt}, -+ {"label": "Sign Keystone ETH-TX (EIP-4527)", "action": sign_keystone_eth_tx}, - ] +@@ def _handle_selected_option(self, option): ++ elif option == "Sign Keystone ETH-TX": ++ from seedsigner.helpers import keystone_sign ++ eth_tx = self.qr_capture_input_screen("Scan ETH TX QR") ++ signed = keystone_sign.sign_eth_tx(eth_tx) ++ self.qr_view_display_screen( ++ signed, ++ title="Signed ETH TX" ++ ) -diff --git a/seedsigner/keystone.py b/seedsigner/keystone.py +diff --git a/seedsigner/helpers/keystone_sign.py b/seedsigner/helpers/keystone_sign.py new file mode 100644 -index 0000000..abcdef3 +index 0000000..2222222 --- /dev/null -+++ b/seedsigner/keystone.py -@@ -0,0 +1,60 @@ -+import ur_registry_eth -+from ur_decoder import URDecoder -+from ur_encoder import UREncoder -+from qr import display_animated_qr, scan_animated_qr -+from satochip_client import SatochipClient -+ -+# BIP44 path for Ethereum -+HD_PATH = "m/44'/60'/0'/0/0" -+ -+def export_keystone_account_qr(): -+ client = SatochipClient() -+ pubkey, chain_code = client.get_public_key(HD_PATH) -+ fingerprint = client.get_master_fingerprint() -+ -+ account = ur_registry_eth.CryptoAccount( -+ account_public_key=pubkey, -+ chain_code=chain_code, -+ master_fingerprint=fingerprint, -+ address_n=[44 | 0x80000000, 60 | 0x80000000, 0 | 0x80000000, 0, 0], -+ script_type="eth" -+ ) -+ ur = ur_registry_eth.encode_crypto_account(account) -+ encoder = UREncoder(ur, max_fragment_len=400) -+ display_animated_qr(encoder) -+ -+def sign_keystone_eth_tx(): -+ decoder = URDecoder() -+ # Scan UR:eth-sign-request frames -+ while not decoder.is_complete(): -+ fragment = scan_animated_qr() -+ decoder.receive(fragment) -+ -+ request = ur_registry_eth.decode_eth_sign_request(decoder.get_message()) -+ tx = request.payload -+ -+ # Sign with Satochip -+ client = SatochipClient() -+ signature = client.sign_eth_transaction(hd_path=HD_PATH, tx=tx) -+ -+ # Encode and display UR:eth-signature -+ eth_sig = ur_registry_eth.EthSignature( -+ request_id=request.request_id, -+ signature=signature -+ ) -+ ur = ur_registry_eth.encode_eth_signature(eth_sig) -+ encoder = UREncoder(ur, max_fragment_len=400) -+ display_animated_qr(encoder) -+``` - ---- - - ++++ b/seedsigner/helpers/keystone_sign.py +@@ ++def sign_eth_tx(payload): ++ import json ++ # Mock signing process ++ try: ++ data = json.loads(payload) ++ data["signature"] = "0xdeadbeef" # Replace with actual ECDSA logic ++ return json.dumps(data) ++ except Exception as e: ++ return json.dumps({"error": str(e)}) \ No newline at end of file