Repository navigation
feat: add standalone Electrum plugin for Pro2 and Neo - #998
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Keep Electrum wallet and transaction validation in Python while using a bounded stdio helper for SDK USB, protocol and session management. Add cancellation, wallet binding, runtime integrity checks and focused regression tests. Validation: 42 Node tests and 9 Python IPC tests passed. Real SDK/native build and Electrum security/loader tests remain dependency-DNS blocked; lint dependencies are missing. Hardware and platform validation are outstanding. Commit hooks skipped once with explicit user approval.
|
@codex review |
|
@codex security review |
|
Cursor review failed. Remote error: |
|
Skipping Bugbot: Bugbot is disabled for this repository. Visit the Bugbot dashboard to update your settings. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…side the plugin The plugin zip stays under Electrum's 10 MB limit. onekey-runtime carries Node 22.21.1 for the six desktop targets and is installed next to it. Review fixes keep the public wallet binding, use Electrum's storage derivation, and ignore disconnects for another device. A locked Pro2/Neo can enter the wizard before device_id exists. A new-wallet xpub fetch does not reuse the previous selection. Closing one wallet or a cancelled call no longer kills another live client or accepts a late success frame. SDK dispose runs before the cancel acknowledgement. The source pin is 38f0b8c, which is already on onekey.
…cancelled A wizard status read shared the client's dialog cancel event. Cancelling its device dialog was treated as a lost connection, which detached the client and dropped its wallet resume entry, and left that event set so the next operation was cancelled at once. Each wizard read now gets its own dialog event, and either it or the page token counts as an intentional stop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Electrum showed "OneKey Neo (OneKey Neo (NED48C04528))": the plugin label repeated the model and exposed the serial number. DeviceInfoGet now also asks for the coprocessor's specific info, and the client label is the Bluetooth advertising name the user sees on the device and in the OneKey app (for example "Neo 36B1", Pro 2 names normalized to "Pro 2 XXXX"). The serial is the fallback label and still drives identity and wallet bindings. An invalid name is dropped and never fails the identity read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and Ledger Electrum's Trezor and Ledger plugins put no wallet options on the script page. Align with them: - A new wallet follows how the device is unlocked (Ledger, whose PIN-bound passphrase matches OneKey's Attach PIN): a locked device accepts either PIN, the Main PIN opens the standard wallet and an Attach PIN its hidden wallet. The wizard no longer forces the Main PIN. - A Main PIN unlock with passphrase enabled asks, as Trezor does, whether to use the standard wallet or enter a passphrase on the device. The passphrase is still never entered on the host. - The script page loses its hidden/Attach PIN checkboxes, the background device probe and the Refresh button. The Testnet legacy multisig default stays. Saved wallets and hardware-encrypted files keep their existing recovery. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New wallets follow the device unlock, so nothing requests the "attach" open
mode any more. Remove it from the device session and the helper's mode
check, together with its ATTACH_PIN_DISABLED error. An Attach PIN wallet is
still opened through PIN_ANY ("current"), and saved Attach PIN wallets
recover as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Electrum swaps each hardware signer's status bar icon between icon_unpaired and icon_paired. Both pointed at the same file, so the icon never showed whether that signer's device was connected. Like Trezor and Ledger, use a grey variant while unpaired. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…an sign firmware-pro2 builds the P2SH multisig scriptSig with signatures[signature_index] and does not pad the list, unlike the witness path. Without the slots the device failed every legacy multisig spend, and the plugin reported SDK_FAILED. Send one empty slot per pubkey, as Electrum's Trezor plugin does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o over Protocol V1 The plugin now drives the older OneKey devices itself instead of leaving them to Electrum's Trezor plugin: - USB: enumerate the WebUSB interface (64-byte interrupt endpoints) on 1209:53C1, 1209:4F4B and 534C:0001 next to the Pro 2 / Neo bulk interface. - LinkV1: "?##" + type + length framing behind the same exchange() contract, so xpub, address, signing and message signing stay shared with V2. - SessionV1: PIN always on the device (BixinPinInputOnDevice for Classic, Classic 1S, Mini and Pure; Touch and Pro prompt themselves), passphrase on the device or the empty standard passphrase. Hidden wallets are identified by GetPassphraseState, or the testnet m/44'/1'/0'/0/0 address on firmware without it, as in the JS SDK. Sessions resume through Initialize. - Identity from V1 Features: serial, model and Bluetooth name with the JS SDK's fallbacks. A OneKey in Trezor-compatible mode is accepted by its OneKey fields; a real Trezor on the same ids is refused. - Classic needs about 1.7 s for GetFeatures, so V1 discovery probes get 5 s. Also replace the "1K" status bar icon with the OneKey logo (grey while unpaired) and add the V1 ids to the udev rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Classic left inside another host's prompt, or woken from idle, answers nothing until it receives a Cancel, so discovery skipped it. Send Cancel when the V1 link opens and drop the reply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e resume ids to the USB claim - New keystores open with a "new" mode that refuses a device already unlocked with an Attach PIN before the wizard step (ATTACH_PIN_ACTIVE). The user locks it and enters the intended PIN in the PIN_ANY prompt, so a hidden account is never bound without being chosen. Storage unlock still follows the current unlock. - A cached wallet resume id is used only on the USB claim that obtained it. On a new claim the path may lead to another device, so the session is re-established through the identity checks without sending the old id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e PIN for new wallets A device unlocked with an Attach PIN before the wizard step was not unlocked for this wallet. Instead of refusing it, lock the device and ask for the PIN with PIN_ANY: the Main PIN adds the standard wallet and an Attach PIN its hidden wallet. Storage unlock still uses the current unlock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Electrum Plugin CI built and size-checked onekey-<version>.zip but discarded it. Upload it with its SHA-256 as "onekey-<version>-<sha8>", and allow a manual run (workflow_dispatch) to build one on demand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
build.py prints an absolute path, so the .sha256 named the runner's path and `sha256sum -c` failed next to the downloaded ZIP. Hash from the output directory with the basename. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This PR adds a standalone Electrum plugin for OneKey Pro 2 and Neo in
plugins/electrum/, version 0.1.0.python3 plugins/electrum/build.pybuildsonekey-0.1.0.zip, which users import from Electrum's plugin window (Electrum ≥ 4.8.4). The ZIP holds only Python code and icons, well below Electrum's 10 MB limit.The plugin talks to the firmware's Protocol V2 (
proto_link, USB1209:4f4c) inside the Electrum process. It starts no Node.js process and needs onlylibusb1, which Electrum already bundles for hardware wallets. Older OneKey devices (Classic, Classic 1S, Mini, Touch, Pro) are not supported by this plugin.Supported
signatures[i]when it builds a P2SH multisig scriptSig.Wallet selection
A new wallet follows how the device is unlocked, as in Electrum's Ledger plugin: a locked device accepts either PIN (
PIN_ANY), the Main PIN opens the standard wallet and an Attach PIN opens its hidden wallet. As in the Trezor plugin, a Main PIN unlock with passphrase enabled asks whether to use the standard wallet or enter a passphrase on the device. The script page has no wallet options and the passphrase is never entered on the host.Keystores save only a public binding (
serialNo,deviceId,walletType,passphraseState) and the account xpub. Firmware session IDs stay in memory. The binding and the unlock state are checked before and after every key, address and signing request, and a saved hidden wallet is reopened only after its passphrase state matches.Electrum integration
Neo 36B1), falling back to the serial.Host dependencies
Linux udev rules and Windows USB drivers are not installed by the plugin.
onekey/56-onekey.rules(VID1209, PID4f4c) is included as a reference.Verification
PYTHONPATH=plugins/electrum python -m pytest plugins/electrum/tests -q: 190 passed, 453 subtests passed.E9,F63,F7,F82passed.The same plugin is proposed upstream in spesmilo/electrum#11161.