@onekeyfe/hardware-cli 1.1.25-alpha.0 → 1.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/cli.ts CHANGED
@@ -14,13 +14,12 @@ const program = new Command();
14
14
  program
15
15
  .name('onekey-hw')
16
16
  .description('OneKey hardware wallet CLI for AI agent integration')
17
- .version('1.1.25-alpha.0');
17
+ .version('1.1.25-alpha.1');
18
18
 
19
19
  // ============================================================
20
20
  // Global Options
21
21
  // ============================================================
22
22
 
23
- program.option('--json', 'Output in JSON format (for agent consumption)');
24
23
  program.option('--connect-id <id>', 'Device connection ID (USB: serial, iOS: uuid, Android: MAC)');
25
24
  program.option(
26
25
  '--device-id <id>',
@@ -36,25 +35,31 @@ program.option('--use-empty-passphrase', 'Use standard wallet (skip passphrase p
36
35
  program
37
36
  .command('search')
38
37
  .description('Search for connected OneKey hardware wallet devices')
39
- .option('--timeout <ms>', 'Search timeout in milliseconds', '10000')
40
- .action(async opts => {
41
- const sdk = await createSDK(program.opts());
42
- try {
43
- const result = await sdk.searchDevices();
44
- outputResult(program.opts(), result);
45
- } finally {
46
- sdk.dispose();
47
- }
48
- });
49
-
50
- program
51
- .command('status')
52
- .description('Get device features and current status')
53
38
  .action(async () => {
54
39
  const globalOpts = program.opts();
55
40
  const sdk = await createSDK(globalOpts);
56
41
  try {
57
- const result = await sdk.getFeatures(globalOpts.connectId);
42
+ const result = await sdk.searchDevices();
43
+
44
+ // Auto-fetch features for each discovered device (doesn't require PIN)
45
+ if (result?.success && Array.isArray(result.payload)) {
46
+ for (const device of result.payload) {
47
+ if (device.connectId) {
48
+ try {
49
+ const features = await sdk.getFeatures(device.connectId);
50
+ if (features?.success && features.payload) {
51
+ device.features = features.payload;
52
+ device.name = features.payload.label || features.payload.ble_name || device.name;
53
+ device.deviceType =
54
+ features.payload.onekey_device_type?.toLowerCase() || device.deviceType;
55
+ }
56
+ } catch {
57
+ // Features fetch failed — device may need PIN, continue with basic info
58
+ }
59
+ }
60
+ }
61
+ }
62
+
58
63
  outputResult(globalOpts, result);
59
64
  } finally {
60
65
  sdk.dispose();
@@ -508,50 +513,30 @@ program
508
513
 
509
514
  program
510
515
  .command('firmware-update')
511
- .description('Update device firmware')
512
- .option('--version <ver>', 'Target firmware version (e.g., "4.8.0")')
513
- .option('--platform <platform>', 'Platform: native | desktop | ext | web', 'desktop')
514
- .action(async opts => {
515
- const globalOpts = program.opts();
516
- const sdk = await createSDK(globalOpts);
517
- try {
518
- // firmwareUpdateV2 requires: connectId, deviceId, { updateType, platform, version? }
519
- const params: Record<string, unknown> = {
520
- updateType: 'firmware',
521
- platform: opts.platform,
522
- };
523
- if (opts.version) {
524
- params.version = parseVersion(opts.version);
525
- }
526
- // firmwareUpdateV2 signature: (connectId, params) — 2 args only
527
- const result = await sdk.firmwareUpdateV2(globalOpts.connectId, params as any);
528
- outputResult(globalOpts, result);
529
- } finally {
530
- sdk.dispose();
531
- }
516
+ .description('Firmware update is not supported via CLI')
517
+ .action(() => {
518
+ outputResult(program.opts(), {
519
+ success: false,
520
+ payload: {
521
+ error:
522
+ 'Firmware update via CLI is not supported. Please use the OneKey App or https://firmware.onekey.so/ to update firmware.',
523
+ code: 'FIRMWARE_UPDATE_NOT_SUPPORTED',
524
+ },
525
+ });
532
526
  });
533
527
 
534
528
  program
535
529
  .command('firmware-update-ble')
536
- .description('Update BLE (Bluetooth) firmware')
537
- .option('--version <ver>', 'Target BLE firmware version')
538
- .option('--platform <platform>', 'Platform: native | desktop | ext | web', 'desktop')
539
- .action(async opts => {
540
- const globalOpts = program.opts();
541
- const sdk = await createSDK(globalOpts);
542
- try {
543
- const params: Record<string, unknown> = {
544
- updateType: 'ble',
545
- platform: opts.platform,
546
- };
547
- if (opts.version) {
548
- params.version = parseVersion(opts.version);
549
- }
550
- const result = await sdk.firmwareUpdateV2(globalOpts.connectId, params as any);
551
- outputResult(globalOpts, result);
552
- } finally {
553
- sdk.dispose();
554
- }
530
+ .description('BLE firmware update is not supported via CLI')
531
+ .action(() => {
532
+ outputResult(program.opts(), {
533
+ success: false,
534
+ payload: {
535
+ error:
536
+ 'BLE firmware update via CLI is not supported. Please use the OneKey App or https://firmware.onekey.so/ to update firmware.',
537
+ code: 'FIRMWARE_UPDATE_NOT_SUPPORTED',
538
+ },
539
+ });
555
540
  });
556
541
 
557
542
  program
@@ -622,66 +607,6 @@ program
622
607
  }
623
608
  });
624
609
 
625
- program
626
- .command('device-backup')
627
- .description('Trigger recovery phrase backup on device')
628
- .action(async () => {
629
- const globalOpts = program.opts();
630
- const sdk = await createSDK(globalOpts);
631
- try {
632
- const result = await sdk.deviceBackup(globalOpts.connectId);
633
- outputResult(globalOpts, result);
634
- } finally {
635
- sdk.dispose();
636
- }
637
- });
638
-
639
- program
640
- .command('device-recovery')
641
- .description('Recover wallet from recovery phrase (entered on device)')
642
- .option('--word-count <count>', 'Recovery phrase length: 12, 18, or 24', '24')
643
- .option('--passphrase-protection <bool>', 'Enable passphrase after recovery', 'false')
644
- .option('--pin-protection <bool>', 'Set PIN after recovery', 'true')
645
- .option('--label <name>', 'Device label')
646
- .action(async opts => {
647
- const globalOpts = program.opts();
648
- const sdk = await createSDK(globalOpts);
649
- try {
650
- const result = await sdk.deviceRecovery(globalOpts.connectId, {
651
- wordCount: safeParseInt(opts.wordCount, '--word-count'),
652
- passphraseProtection: opts.passphraseProtection === 'true',
653
- pinProtection: opts.pinProtection === 'true',
654
- label: opts.label,
655
- });
656
- outputResult(globalOpts, result);
657
- } finally {
658
- sdk.dispose();
659
- }
660
- });
661
-
662
- program
663
- .command('device-reset')
664
- .description('Initialize device with a new wallet seed (DESTROYS current wallet)')
665
- .option('--word-count <count>', 'Seed phrase length: 12, 18, or 24', '24')
666
- .option('--passphrase-protection <bool>', 'Enable passphrase', 'false')
667
- .option('--pin-protection <bool>', 'Set PIN', 'true')
668
- .option('--label <name>', 'Device label')
669
- .action(async opts => {
670
- const globalOpts = program.opts();
671
- const sdk = await createSDK(globalOpts);
672
- try {
673
- const result = await sdk.deviceReset(globalOpts.connectId, {
674
- strength: wordCountToStrength(safeParseInt(opts.wordCount, '--word-count')),
675
- passphraseProtection: opts.passphraseProtection === 'true',
676
- pinProtection: opts.pinProtection === 'true',
677
- label: opts.label,
678
- });
679
- outputResult(globalOpts, result);
680
- } finally {
681
- sdk.dispose();
682
- }
683
- });
684
-
685
610
  program
686
611
  .command('device-wipe')
687
612
  .description('Factory reset — erase ALL data (IRREVERSIBLE)')
@@ -784,29 +709,15 @@ function getCommonParams(globalOpts: Record<string, any>) {
784
709
  };
785
710
  }
786
711
 
787
- function outputResult(globalOpts: { json?: boolean }, result: unknown): void {
712
+ function outputResult(_globalOpts: Record<string, any>, result: unknown): void {
788
713
  // #10 FIX: Always use JSON.stringify to avoid [Object] truncation
789
714
  console.log(JSON.stringify(result, null, 2));
790
715
 
791
- // #11 FIX: Exit with code 1 on SDK failure
716
+ // Exit after output SDK event listeners keep the process alive otherwise
792
717
  if (result && typeof result === 'object' && 'success' in result && !(result as any).success) {
793
- process.exitCode = 1;
794
- }
795
- }
796
-
797
- function wordCountToStrength(wordCount: number): number {
798
- // #8 FIX: Validate word count is one of the allowed values
799
- if (![12, 18, 24].includes(wordCount)) {
800
- throw new Error(`Invalid word count: ${wordCount}. Must be 12, 18, or 24.`);
801
- }
802
- switch (wordCount) {
803
- case 12:
804
- return 128;
805
- case 18:
806
- return 192;
807
- case 24:
808
- default:
809
- return 256;
718
+ process.exit(1);
719
+ } else {
720
+ process.exit(0);
810
721
  }
811
722
  }
812
723
 
@@ -841,15 +752,4 @@ function safeParseInt(input: string, label: string): number {
841
752
  return num;
842
753
  }
843
754
 
844
- /**
845
- * #15 FIX: Validate firmware version format
846
- */
847
- function parseVersion(input: string): number[] {
848
- const parts = input.split('.').map(Number);
849
- if (parts.length < 2 || parts.length > 4 || parts.some(Number.isNaN)) {
850
- throw new Error(`Invalid version format: "${input}". Expected format: "4.8.0"`);
851
- }
852
- return parts;
853
- }
854
-
855
755
  program.parse();
package/src/index.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * npx @onekeyfe/hardware-cli get-address --chain evm
11
11
  * npx @onekeyfe/hardware-cli sign-transaction --chain evm --tx '{...}'
12
12
  *
13
- * For AI agent integration, use --json flag for structured output.
13
+ * All output is structured JSON for AI agent consumption.
14
14
  *
15
15
  * IMPORTANT: All signing operations require physical confirmation on the
16
16
  * hardware device. The CLI handles PIN/Passphrase prompts via stdin for
package/src/sdk.ts CHANGED
@@ -17,7 +17,6 @@ import * as readline from 'readline';
17
17
  import type { ConnectSettings } from '@onekeyfe/hd-core';
18
18
 
19
19
  export interface SDKOptions {
20
- json?: boolean;
21
20
  connectId?: string;
22
21
  passphraseState?: string;
23
22
  useEmptyPassphrase?: boolean;
@@ -165,16 +164,18 @@ function registerEventHandlers(sdk: typeof HardwareSDK, opts: SDKOptions): void
165
164
  }
166
165
  });
167
166
 
168
- // Device connection events
167
+ // Device connection events — only show when device has a known name
169
168
  sdk.on(DEVICE.CONNECT, (device: any) => {
170
- if (!opts.json) {
171
- process.stderr.write(`[onekey-hw] Device connected: ${device?.name || 'Unknown'}\n`);
169
+ const name = device?.label || device?.name;
170
+ if (name) {
171
+ process.stderr.write(`[onekey-hw] Device connected: ${name}\n`);
172
172
  }
173
173
  });
174
174
 
175
175
  sdk.on(DEVICE.DISCONNECT, (device: any) => {
176
- if (!opts.json) {
177
- process.stderr.write(`[onekey-hw] Device disconnected: ${device?.name || 'Unknown'}\n`);
176
+ const name = device?.label || device?.name;
177
+ if (name) {
178
+ process.stderr.write(`[onekey-hw] Device disconnected: ${name}\n`);
178
179
  }
179
180
  });
180
181
  }
@@ -1,191 +0,0 @@
1
- ---
2
- name: hardware-device
3
- description: OneKey hardware wallet device management. Use whenever the user
4
- wants to search for, connect to, or check the status of their OneKey
5
- hardware wallet device. Also triggered as a pre-check before any signing
6
- or firmware operation to ensure a device is connected and ready.
7
- keywords: [device, connect, search, hardware, onekey, status, features, disconnect]
8
- ---
9
-
10
- ## Pre-flight Checks
11
-
12
- Every time before running any `onekey-hw` command, follow these steps in order.
13
- Do not echo routine command output to the user; only provide a brief status
14
- update when installing, updating, or handling a failure.
15
-
16
- 1. **Check CLI installed**: Run `onekey-hw --version`.
17
- - Not found → install: `npm install -g @onekeyfe/hardware-cli`
18
- - Install failed → STOP, point to manual install docs.
19
-
20
- 2. **Check version is latest** (once per session):
21
- - Fetch latest: `npm view @onekeyfe/hardware-cli version`
22
- - Compare with local `onekey-hw --version`
23
- - Local version behind → **BLOCK operation**, run `npm update -g @onekeyfe/hardware-cli`
24
- - Update failed → STOP, suggest manual update.
25
- - Update succeeded → continue with original command.
26
-
27
- ## Device Interaction Model
28
-
29
- **CRITICAL: Most `onekey-hw` commands block while waiting for physical interaction
30
- on the hardware device (PIN entry, button confirmation, address verification).
31
- You MUST inform the user BEFORE running the command.**
32
-
33
- ### How It Works
34
-
35
- 1. **Before running the command** → Tell the user what device interaction to expect.
36
- 2. **Run the command** → It blocks (up to 60s) while waiting for the user to act on the device.
37
- The user sees real-time `[onekey-hw]` status messages in their terminal (via stderr).
38
- 3. **Command completes** → You see the full output and present the result.
39
-
40
- ### Device Interaction Types
41
-
42
- | Stderr Message | What User Must Do | When It Happens |
43
- |---|---|---|
44
- | `[onekey-hw] Please enter PIN on your device screen...` | Enter PIN on device touchscreen | First operation after device lock/connect |
45
- | `[onekey-hw] Please confirm the action on your device...` | Press confirm button on device | Address display, signing, settings changes |
46
- | `[onekey-hw] Passphrase required for hidden wallet.` | Enter passphrase on device | When accessing a hidden wallet |
47
-
48
- ### Timeout Guidance
49
-
50
- - Set Bash tool `timeout` to at least `120000` (120s) for any command that requires
51
- device interaction (signing, address with `--show-on-device`, PIN changes, etc.)
52
- - `search` does NOT require device interaction — default timeout is fine.
53
- - If a command times out, the user likely did not respond on the device — do NOT retry
54
- automatically. Ask the user if they want to try again.
55
-
56
- ### Example Interaction Pattern
57
-
58
- ```
59
- Agent → User: "I'm going to request your ETH address from the device.
60
- You may need to enter your PIN and confirm on the device screen."
61
- Agent → Bash: onekey-hw get-address --chain evm --connect-id <id> (timeout: 120000)
62
- [user sees in terminal: "[onekey-hw] Please enter PIN on your device screen..."]
63
- [user enters PIN on device]
64
- [user sees in terminal: "[onekey-hw] Please confirm the action on your device..."]
65
- [user confirms on device]
66
- Agent ← result: { success: true, payload: { address: "0x..." } }
67
- Agent → User: "Your ETH address is 0x..."
68
- ```
69
-
70
- ## Security Rules — ABSOLUTE
71
-
72
- - NEVER expose device seeds, mnemonics, or private keys in any output.
73
- - All signing operations REQUIRE physical confirmation on the hardware device.
74
- - NEVER bypass device confirmation prompts — if the device is waiting for user
75
- confirmation, inform the user and wait.
76
- - NEVER attempt to brute-force PINs or passphrases.
77
- - Treat all device state information (features, serial numbers) as sensitive —
78
- do not share externally without user consent.
79
-
80
- ## Parameter Rules
81
-
82
- ### Device Identification
83
-
84
- - `--connect-id`: Connection identifier from `search` results.
85
- - `--device-id`: Persistent device identifier from `getFeatures`.
86
- - When multiple devices connected, ALWAYS ask user to select.
87
-
88
- ## Commands
89
-
90
- ### `onekey-hw search`
91
-
92
- Search for connected OneKey hardware wallet devices.
93
- **Does NOT require device interaction — no PIN or confirmation needed.**
94
-
95
- ```bash
96
- onekey-hw search [--timeout <ms>]
97
- ```
98
-
99
- | Parameter | Required | Description |
100
- |---|---|---|
101
- | `--timeout` | No | Search timeout in milliseconds (default: 10000) |
102
-
103
- **Returns:**
104
- ```json
105
- {
106
- "success": true,
107
- "payload": [
108
- {
109
- "connectId": "PRC49J0370A",
110
- "name": "OneKey Pro",
111
- "deviceType": "pro"
112
- }
113
- ]
114
- }
115
- ```
116
-
117
- **Agent notes:**
118
- - Always run `search` before any device operation if no `connectId` is known.
119
- - If no devices found, suggest: check USB cable, unlock device, try a different USB port.
120
- - Multiple devices → present list, ask user to select.
121
-
122
- ### `onekey-hw status`
123
-
124
- Get detailed device features and current status.
125
- **May require PIN entry on device if device is locked.**
126
-
127
- ```bash
128
- onekey-hw status [--connect-id <id>]
129
- ```
130
-
131
- **Agent notes:**
132
- - Use this to verify device state before any operation.
133
- - If `initialized` is false, guide user through device setup.
134
- - If `needsBackup` is true, strongly recommend backup before any signing.
135
- - If `bootloaderMode` is true, only firmware operations are available.
136
- - **Warn user before running:** "You may need to enter your PIN on the device."
137
-
138
- ### `onekey-hw lock`
139
-
140
- Lock the device (require PIN to unlock).
141
-
142
- ```bash
143
- onekey-hw lock [--connect-id <id>]
144
- ```
145
-
146
- ## Workflows
147
-
148
- ### First Connection
149
-
150
- ```
151
- User: "Connect my OneKey hardware wallet"
152
-
153
- Step 1 — Search for devices (no device interaction needed)
154
- → onekey-hw search --json
155
- → If no devices found, guide troubleshooting (USB cable, unlock, different port)
156
-
157
- Step 2 — Tell user what to expect
158
- → "Found your OneKey Pro. I'll check its status now — you may need to enter
159
- your PIN on the device."
160
-
161
- Step 3 — Check device status (may need PIN)
162
- → onekey-hw status --connect-id <id> [timeout: 120000]
163
- → Report: model, firmware version, PIN status, backup status
164
- ```
165
-
166
- ### Troubleshooting Connection
167
-
168
- ```
169
- User: "My device won't connect"
170
-
171
- Step 1 — Search with extended timeout
172
- → onekey-hw search --timeout 30000
173
-
174
- Step 2 — Guide the user:
175
- - Is the device powered on and unlocked?
176
- - Try a different USB cable or port
177
- - On Linux, check udev rules for HID device permissions
178
- ```
179
-
180
- ## When To Use
181
-
182
- - User asks to connect, find, or search for their hardware wallet.
183
- - User asks about device status, firmware version, or device info.
184
- - Pre-check before any signing or firmware operation.
185
- - User reports connection issues.
186
-
187
- ## When NOT To Use
188
-
189
- - User wants to sign a transaction → use `hardware-signing`.
190
- - User wants to update firmware → use `hardware-firmware`.
191
- - User wants to change PIN or passphrase → use `hardware-security`.
@@ -1,163 +0,0 @@
1
- ---
2
- name: hardware-firmware
3
- description: OneKey hardware wallet firmware management. Use whenever the user
4
- wants to check for firmware updates, update their device firmware (system
5
- or BLE), check bootloader status, or verify firmware compatibility.
6
- keywords: [firmware, update, version, upgrade, bootloader, ble, bluetooth]
7
- ---
8
-
9
- ## Pre-flight Checks
10
-
11
- Every time before running any `onekey-hw` command, follow these steps in order.
12
-
13
- 1. **Check CLI installed**: Run `onekey-hw --version`.
14
- - Not found → install: `npm install -g @onekeyfe/hardware-cli`
15
-
16
- 2. **Check device connected**: Run `onekey-hw search --json`.
17
- - No device → guide troubleshooting (USB cable, unlock device, different port).
18
-
19
- ## Device Interaction — IMPORTANT
20
-
21
- **Firmware commands block while waiting for device interaction (PIN, confirmation).**
22
- Always warn the user before running: "You may need to enter your PIN and confirm
23
- on the device." Use `timeout: 300000` (5 minutes) for firmware update commands —
24
- updates take 1-3 minutes to complete.
25
-
26
- ## Security Rules — ABSOLUTE
27
-
28
- ### Firmware Update Safety
29
-
30
- - NEVER interrupt a firmware update in progress — this can BRICK the device.
31
- - ALWAYS ensure the device has sufficient battery before starting (if applicable).
32
- - ALWAYS confirm with the user before starting a firmware update:
33
- "Firmware updates modify your device's system software. Do NOT disconnect
34
- the device during the update. Continue?"
35
- - After firmware update, the device may require re-entering the PIN.
36
- - Firmware updates do NOT erase wallet data (seeds are preserved in the secure element).
37
-
38
- ### Bootloader Safety
39
-
40
- - If the device is in bootloader mode, only firmware update operations are available.
41
- - NEVER attempt to exit bootloader mode during an active update.
42
- - If the device is stuck in bootloader mode unexpectedly, guide the user to
43
- contact OneKey support.
44
-
45
- ## Commands
46
-
47
- ### `onekey-hw firmware-check`
48
-
49
- Check if a firmware update is available for the connected device.
50
-
51
- ```bash
52
- onekey-hw firmware-check [--connect-id <id>]
53
- ```
54
-
55
- **Agent notes:**
56
- - Always check firmware before any operation to ensure compatibility.
57
- - If `required` is true, the update is mandatory — signing may not work until updated.
58
- - Present changelog to user so they can make an informed decision.
59
-
60
- ### `onekey-hw firmware-check-all`
61
-
62
- Check all firmware components at once (system, BLE, bootloader).
63
-
64
- ```bash
65
- onekey-hw firmware-check-all [--connect-id <id>]
66
- ```
67
-
68
- ### `onekey-hw firmware-update`
69
-
70
- Update the device firmware (system firmware).
71
-
72
- ```bash
73
- onekey-hw firmware-update \
74
- [--connect-id <id>] \
75
- [--version <version>] \
76
- [--platform <platform>]
77
- ```
78
-
79
- | Parameter | Required | Description |
80
- |---|---|---|
81
- | `--connect-id` | No | Device connection ID |
82
- | `--version` | No | Target version, e.g. "4.8.0" (defaults to latest) |
83
- | `--platform` | No | Platform: native, desktop, ext, web (default: desktop) |
84
-
85
- **Agent notes:**
86
- - This operation takes 1-3 minutes. Inform the user to be patient.
87
- - The device will reboot during the update — this is normal.
88
- - After update, run `onekey-hw search` again to re-detect the device.
89
- - If the update fails, the device may enter bootloader mode — guide recovery.
90
-
91
- ### `onekey-hw firmware-update-ble`
92
-
93
- Update the BLE (Bluetooth) firmware.
94
-
95
- ```bash
96
- onekey-hw firmware-update-ble \
97
- [--connect-id <id>] \
98
- [--version <version>] \
99
- [--platform <platform>]
100
- ```
101
-
102
- **Agent notes:**
103
- - BLE update is separate from system firmware update.
104
- - Only applicable for devices with Bluetooth capability (Touch, Pro).
105
- - After BLE update, Bluetooth pairing may need to be re-established.
106
-
107
- ### `onekey-hw bootloader-check`
108
-
109
- Check bootloader version and status.
110
-
111
- ```bash
112
- onekey-hw bootloader-check [--connect-id <id>]
113
- ```
114
-
115
- ## Workflows
116
-
117
- ### Check & Update Firmware
118
-
119
- ```
120
- User: "Is my firmware up to date?"
121
-
122
- Step 1 — Check all components
123
- → onekey-hw firmware-check-all --connect-id <id> --json
124
- → Present results in a clear table
125
-
126
- Step 2 — If updates available, ask user
127
- → "BLE firmware v2.1.0 is available (current: v2.0.0). Changes: Improved BLE stability."
128
- → "Would you like to update?"
129
-
130
- Step 3 — User confirms → update
131
- → "DO NOT disconnect your device during the update."
132
- → onekey-hw firmware-update-ble --connect-id <id>
133
- → "BLE firmware updated to v2.1.0."
134
- ```
135
-
136
- ### Recover from Bootloader Mode
137
-
138
- ```
139
- User: "My device shows a bootloader screen"
140
-
141
- Step 1 — Verify bootloader mode
142
- → onekey-hw status --connect-id <id>
143
- → If bootloaderMode: true, proceed
144
-
145
- Step 2 — Attempt firmware update to recover
146
- → "Your device is in bootloader mode. This usually means a firmware update
147
- was interrupted. Let's reinstall the firmware."
148
- → onekey-hw firmware-update --connect-id <id>
149
- → "Firmware installed. Your device should restart normally."
150
- ```
151
-
152
- ## When To Use
153
-
154
- - User asks about firmware versions or updates.
155
- - User wants to update device firmware.
156
- - Device is in bootloader mode and needs recovery.
157
- - Pre-check before signing to ensure firmware compatibility.
158
-
159
- ## When NOT To Use
160
-
161
- - User wants to sign transactions → use `hardware-signing`.
162
- - User wants to connect devices → use `hardware-device`.
163
- - User wants to change PIN/passphrase → use `hardware-security`.