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

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.
@@ -1,328 +0,0 @@
1
- ---
2
- name: hardware-security
3
- description: OneKey hardware wallet security and device management — PIN changes,
4
- passphrase settings, device backup, recovery, reset, and wipe. Use whenever
5
- the user wants to change their PIN, enable/disable passphrase protection,
6
- back up their device, recover from a seed phrase, reset to factory, or
7
- manage device security settings.
8
- keywords: [pin, passphrase, backup, reset, wipe, recovery, security, seed,
9
- factory-reset, label, settings, lock]
10
- ---
11
-
12
- ## Pre-flight Checks
13
-
14
- Every time before running any `onekey-hw` command, follow these steps in order.
15
-
16
- 1. **Check CLI installed**: Run `onekey-hw --version`.
17
- - Not found → install: `npm install -g @onekeyfe/hardware-cli`
18
-
19
- 2. **Check device connected**: Run `onekey-hw search --json`.
20
- - No device → guide troubleshooting (USB cable, unlock device, different port).
21
-
22
- ## Device Interaction — IMPORTANT
23
-
24
- **All security commands require physical interaction on the device (PIN entry,
25
- button confirmation).** Always warn the user before running any command:
26
- "You will need to interact with your device — enter PIN, confirm actions, etc."
27
- Use `timeout: 120000` (120 seconds) for most commands, `timeout: 300000`
28
- (5 minutes) for recovery/reset operations that involve multi-step device interaction.
29
-
30
- ## Security Rules — ABSOLUTE
31
-
32
- ### CRITICAL — Destructive Operations
33
-
34
- - `device-wipe` erases ALL data including seeds. This is IRREVERSIBLE.
35
- - MUST confirm with user AT LEAST TWICE before executing.
36
- - MUST verify user has their recovery phrase backed up.
37
- - "WARNING: This will permanently erase all data on your device including
38
- your wallet. This CANNOT be undone. Do you have your recovery phrase
39
- backed up? Type 'WIPE' to confirm."
40
-
41
- - `device-reset` generates a new wallet seed. The old seed is DESTROYED.
42
- - Same double-confirmation as wipe.
43
- - "This will create a new wallet and DESTROY the current one."
44
-
45
- ### FORBIDDEN — Seeds & Recovery Phrases
46
-
47
- - NEVER ask for, display, or log recovery phrases / seed words.
48
- - During `device-recovery`, the seed is entered DIRECTLY on the hardware device.
49
- - NEVER suggest the user type their seed into the terminal, chat, or any software.
50
- - The ONLY safe place to enter a recovery phrase is on the device screen itself.
51
-
52
- ### PIN Security
53
-
54
- - NEVER ask for or attempt to see the user's PIN.
55
- - PIN is always entered on the device screen.
56
- - After 16 wrong PIN attempts, the device wipes itself — inform user of this.
57
-
58
- ## Commands
59
-
60
- ### `onekey-hw change-pin`
61
-
62
- Change, set, or remove the device PIN code.
63
-
64
- ```bash
65
- onekey-hw change-pin [--remove] [--connect-id <id>]
66
- ```
67
-
68
- | Parameter | Required | Description |
69
- |---|---|---|
70
- | `--remove` | No | Remove PIN protection instead of changing |
71
-
72
- **Agent notes:**
73
- - PIN entry happens entirely on the device screen — the CLI does not see the PIN.
74
- - If no PIN was set, this creates a new PIN.
75
- - If PIN was already set, device will ask for current PIN first, then new PIN twice.
76
- - Use `--remove` to disable PIN protection (NOT recommended).
77
- - Instruct user: "Follow the prompts on your device screen to set your new PIN."
78
-
79
- ### `onekey-hw passphrase-state`
80
-
81
- Get current passphrase state for hidden wallet session management.
82
-
83
- ```bash
84
- onekey-hw passphrase-state [--use-empty-passphrase] [--connect-id <id>]
85
- ```
86
-
87
- **Agent notes:**
88
- - Returns a hash identifying the current passphrase wallet session.
89
- - Use `--use-empty-passphrase` to get state for the standard (non-hidden) wallet.
90
- - Pass the returned state as `--passphrase-state` to subsequent commands to avoid
91
- re-prompting the passphrase on every operation.
92
-
93
- ### `onekey-hw toggle-passphrase`
94
-
95
- Enable or disable BIP39 passphrase (hidden wallet) protection.
96
-
97
- ```bash
98
- onekey-hw toggle-passphrase \
99
- --enable <bool> \
100
- [--connect-id <id>]
101
- ```
102
-
103
- | Parameter | Required | Description |
104
- |---|---|---|
105
- | `--enable` | Yes | `true` to enable, `false` to disable |
106
-
107
- **Agent notes:**
108
- - Passphrase creates a "hidden wallet" — different passphrase = different wallet.
109
- - WARN user: "If you forget your passphrase, there is NO way to recover the
110
- hidden wallet's funds. The passphrase is NOT stored on the device."
111
- - When enabled, every signing/address operation will ask for the passphrase on device.
112
-
113
- ### `onekey-hw device-backup`
114
-
115
- Trigger the device to display the recovery phrase for backup verification.
116
-
117
- ```bash
118
- onekey-hw device-backup [--connect-id <id>]
119
- ```
120
-
121
- **Agent notes:**
122
- - The recovery phrase is shown ONLY on the device screen — never transmitted to the CLI.
123
- - Instruct user: "Your recovery phrase will be displayed on the device screen.
124
- Write it down on paper and store it securely. NEVER take a photo or store digitally."
125
- - The device will quiz the user to verify they wrote it down correctly.
126
-
127
- ### `onekey-hw device-recovery`
128
-
129
- Recover a wallet from an existing recovery phrase. The seed is entered on the device.
130
-
131
- ```bash
132
- onekey-hw device-recovery \
133
- [--word-count <12|18|24>] \
134
- [--passphrase-protection <bool>] \
135
- [--pin-protection <bool>] \
136
- [--label <name>] \
137
- [--connect-id <id>]
138
- ```
139
-
140
- | Parameter | Required | Description |
141
- |---|---|---|
142
- | `--word-count` | No | Recovery phrase length: 12, 18, or 24 (default: 24) |
143
- | `--passphrase-protection` | No | Enable passphrase after recovery (default: false) |
144
- | `--pin-protection` | No | Set PIN after recovery (default: true) |
145
- | `--label` | No | Device label / name |
146
-
147
- **Agent notes:**
148
- - Recovery phrase is entered DIRECTLY on the device screen — NEVER in the CLI or chat.
149
- - Instruct user: "You will enter your recovery words one by one on the device screen."
150
- - This replaces any existing wallet on the device.
151
-
152
- ### `onekey-hw device-reset`
153
-
154
- Initialize the device with a newly generated seed.
155
-
156
- ```bash
157
- onekey-hw device-reset \
158
- [--word-count <12|18|24>] \
159
- [--passphrase-protection <bool>] \
160
- [--pin-protection <bool>] \
161
- [--label <name>] \
162
- [--connect-id <id>]
163
- ```
164
-
165
- | Parameter | Required | Description |
166
- |---|---|---|
167
- | `--word-count` | No | Seed phrase length: 12, 18, or 24 (default: 24) |
168
- | `--passphrase-protection` | No | Enable passphrase (default: false) |
169
- | `--pin-protection` | No | Set PIN (default: true) |
170
- | `--label` | No | Device label / name |
171
-
172
- **Agent notes:**
173
- - This DESTROYS the current wallet and creates a new one.
174
- - Double-confirm with user before executing.
175
- - After reset, IMMEDIATELY guide user to `device-backup` to write down the new seed.
176
-
177
- ### `onekey-hw device-wipe`
178
-
179
- Factory reset — erase all data from the device.
180
-
181
- ```bash
182
- onekey-hw device-wipe [--connect-id <id>]
183
- ```
184
-
185
- **Agent notes:**
186
- - This is the most destructive operation. ALL data is permanently erased.
187
- - Require EXPLICIT double confirmation:
188
- 1. "This will erase everything on your device. Do you have your recovery phrase?"
189
- 2. "Type 'WIPE' to confirm factory reset."
190
- - The device will also ask for confirmation on its screen.
191
-
192
- ### `onekey-hw device-settings`
193
-
194
- Update device label and other settings.
195
-
196
- ```bash
197
- onekey-hw device-settings \
198
- [--label <name>] \
199
- [--auto-lock-delay <seconds>] \
200
- [--language <lang>] \
201
- [--passphrase-always-on-device <bool>] \
202
- [--haptic-feedback <bool>] \
203
- [--auto-shutdown-delay <seconds>] \
204
- [--connect-id <id>]
205
- ```
206
-
207
- | Parameter | Required | Description |
208
- |---|---|---|
209
- | `--label` | No | Device display name |
210
- | `--auto-lock-delay` | No | Auto-lock timeout in seconds (0 = disabled) |
211
- | `--language` | No | Device UI language |
212
- | `--passphrase-always-on-device` | No | Always enter passphrase on device screen |
213
- | `--haptic-feedback` | No | Enable/disable haptic feedback (true/false) |
214
- | `--auto-shutdown-delay` | No | Auto power-off timeout in seconds |
215
-
216
- ### `onekey-hw device-verify`
217
-
218
- Verify the device is genuine OneKey hardware (anti-tampering check).
219
-
220
- ```bash
221
- onekey-hw device-verify [--connect-id <id>]
222
- ```
223
-
224
- **Agent notes:**
225
- - Run this when user has concerns about device authenticity.
226
- - If verification fails, advise user to contact OneKey support immediately
227
- and NOT use the device for any transactions.
228
-
229
- ### `onekey-hw lock`
230
-
231
- Lock the device (require PIN to unlock).
232
-
233
- ```bash
234
- onekey-hw lock [--connect-id <id>]
235
- ```
236
-
237
- ## Workflows
238
-
239
- ### First-Time Device Setup
240
-
241
- ```
242
- User: "Set up my new OneKey device"
243
-
244
- Step 1 — Search and verify
245
- → onekey-hw search --json
246
- → onekey-hw device-verify --connect-id <id>
247
- → "Device verified as genuine OneKey hardware."
248
-
249
- Step 2 — Initialize with new wallet
250
- → "This will create a new wallet. You'll set a PIN and back up your recovery phrase."
251
- → onekey-hw device-reset --word-count 24 --pin-protection true --label "My OneKey" --connect-id <id>
252
-
253
- Step 3 — Backup recovery phrase
254
- → onekey-hw device-backup --connect-id <id>
255
- → "Write down the 24 words shown on your device. Store securely offline."
256
-
257
- Step 4 — Verify setup
258
- → onekey-hw status --connect-id <id>
259
- → Display device info, confirm PIN and backup status.
260
- ```
261
-
262
- ### Change PIN
263
-
264
- ```
265
- User: "Change my device PIN"
266
-
267
- Step 1 — Verify device connected
268
- → onekey-hw search --json
269
-
270
- Step 2 — Change PIN
271
- → onekey-hw change-pin --connect-id <id>
272
- → "Follow the prompts on your device screen:
273
- 1. Enter your current PIN
274
- 2. Enter your new PIN
275
- 3. Confirm your new PIN"
276
- ```
277
-
278
- ### Enable Hidden Wallet (Passphrase)
279
-
280
- ```
281
- User: "Enable passphrase on my device"
282
-
283
- Step 1 — Explain implications
284
- → "Passphrase creates a hidden wallet. Each different passphrase produces
285
- a completely different set of addresses and funds. If you forget the
286
- passphrase, those funds are PERMANENTLY inaccessible."
287
-
288
- Step 2 — Confirm user understands
289
- → Wait for explicit "I understand" / "yes"
290
-
291
- Step 3 — Enable
292
- → onekey-hw toggle-passphrase --enable true --connect-id <id>
293
- → "Passphrase protection enabled."
294
- ```
295
-
296
- ### Factory Reset
297
-
298
- ```
299
- User: "Reset my device to factory settings"
300
-
301
- Step 1 — Double confirmation
302
- → "WARNING: Factory reset will PERMANENTLY erase all data on your device,
303
- including your wallet seed. This CANNOT be undone."
304
- → "Do you have your recovery phrase backed up?"
305
- → Wait for confirmation
306
-
307
- Step 2 — Second confirmation
308
- → "Type 'WIPE' to confirm factory reset."
309
-
310
- Step 3 — Execute
311
- → onekey-hw device-wipe --connect-id <id>
312
- → "Device has been wiped. You can set it up as new or recover from a seed."
313
- ```
314
-
315
- ## When To Use
316
-
317
- - User wants to change PIN or passphrase settings.
318
- - User wants to back up or verify their recovery phrase.
319
- - User wants to recover a wallet from seed.
320
- - User wants to factory reset their device.
321
- - User wants to check device authenticity.
322
- - User wants to change device label or settings.
323
-
324
- ## When NOT To Use
325
-
326
- - User wants to sign transactions → use `hardware-signing`.
327
- - User wants to update firmware → use `hardware-firmware`.
328
- - User wants to connect or search devices → use `hardware-device`.