@onekeyfe/hd-transport 1.2.0-alpha.55 → 1.2.0-alpha.57
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/__tests__/protocol-v2.test.js +3 -1
- package/dist/index.d.ts +225 -1
- package/dist/index.js +11 -7
- package/dist/protocols/v2/session.d.ts +2 -0
- package/dist/protocols/v2/session.d.ts.map +1 -1
- package/dist/types/messages.d.ts +165 -0
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/transport.d.ts +1 -0
- package/dist/types/transport.d.ts.map +1 -1
- package/package.json +2 -2
- package/scripts/protobuf-patches/index.js +0 -28
- package/src/protocols/v2/session.ts +5 -0
- package/src/types/messages.ts +217 -0
- package/src/types/transport.ts +2 -0
|
@@ -225,34 +225,6 @@ const SKIP = [
|
|
|
225
225
|
'TransactionType', // connect uses custom definition
|
|
226
226
|
'TxInput', // declared in TxInputType patch
|
|
227
227
|
'TxOutput', // declared in TxOutputType patch
|
|
228
|
-
// not implemented
|
|
229
|
-
'CosiCommit',
|
|
230
|
-
'CosiCommitment',
|
|
231
|
-
'CosiSign',
|
|
232
|
-
'CosiSignature',
|
|
233
|
-
'DebugSwipeDirection',
|
|
234
|
-
'DebugLinkDecision',
|
|
235
|
-
'DebugLinkLayout',
|
|
236
|
-
'DebugLinkReseedRandom',
|
|
237
|
-
'DebugLinkRecordScreen',
|
|
238
|
-
'DebugLinkGetState',
|
|
239
|
-
'DebugLinkState',
|
|
240
|
-
'DebugLinkStop',
|
|
241
|
-
'DebugLinkLog',
|
|
242
|
-
'DebugLinkMemoryRead',
|
|
243
|
-
'DebugLinkMemory',
|
|
244
|
-
'DebugLinkMemoryWrite',
|
|
245
|
-
'DebugLinkFlashErase',
|
|
246
|
-
'DebugLinkEraseSdCard',
|
|
247
|
-
'DebugLinkWatchLayout',
|
|
248
|
-
'LoadDevice',
|
|
249
|
-
'DebugMoneroDiagRequest',
|
|
250
|
-
'DebugMoneroDiagAck',
|
|
251
|
-
'WebAuthnListResidentCredentials',
|
|
252
|
-
'WebAuthnAddResidentCredential',
|
|
253
|
-
'WebAuthnRemoveResidentCredential',
|
|
254
|
-
'WebAuthnCredential',
|
|
255
|
-
'WebAuthnCredentials',
|
|
256
228
|
'wire_in',
|
|
257
229
|
'wire_out',
|
|
258
230
|
'wire_debug_in',
|
|
@@ -23,6 +23,7 @@ export type ProtocolV2CallContext = {
|
|
|
23
23
|
messageName: string;
|
|
24
24
|
timeoutMs?: number;
|
|
25
25
|
highVolume: boolean;
|
|
26
|
+
writeWithResponse?: boolean;
|
|
26
27
|
generation: number;
|
|
27
28
|
signal: AbortSignal;
|
|
28
29
|
};
|
|
@@ -52,6 +53,7 @@ export type ProtocolV2CallOptions = {
|
|
|
52
53
|
expectedTypes?: string[];
|
|
53
54
|
intermediateTypes?: string[];
|
|
54
55
|
onIntermediateResponse?: (response: MessageFromOneKey) => void;
|
|
56
|
+
writeWithResponse?: boolean;
|
|
55
57
|
};
|
|
56
58
|
|
|
57
59
|
export { concatUint8Arrays, ProtocolV2FrameAssembler };
|
|
@@ -220,6 +222,9 @@ export class ProtocolV2Session {
|
|
|
220
222
|
messageName: name,
|
|
221
223
|
timeoutMs,
|
|
222
224
|
highVolume: shouldReduceDebug,
|
|
225
|
+
...(callOptions.writeWithResponse === undefined
|
|
226
|
+
? {}
|
|
227
|
+
: { writeWithResponse: callOptions.writeWithResponse }),
|
|
223
228
|
generation,
|
|
224
229
|
signal: abortController.signal,
|
|
225
230
|
};
|
package/src/types/messages.ts
CHANGED
|
@@ -1423,6 +1423,31 @@ export type ECDHSessionKey = {
|
|
|
1423
1423
|
public_key?: string;
|
|
1424
1424
|
};
|
|
1425
1425
|
|
|
1426
|
+
// CosiCommit
|
|
1427
|
+
export type CosiCommit = {
|
|
1428
|
+
address_n: number[];
|
|
1429
|
+
data?: string;
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
// CosiCommitment
|
|
1433
|
+
export type CosiCommitment = {
|
|
1434
|
+
commitment?: string;
|
|
1435
|
+
pubkey?: string;
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1438
|
+
// CosiSign
|
|
1439
|
+
export type CosiSign = {
|
|
1440
|
+
address_n: number[];
|
|
1441
|
+
data?: string;
|
|
1442
|
+
global_commitment?: string;
|
|
1443
|
+
global_pubkey?: string;
|
|
1444
|
+
};
|
|
1445
|
+
|
|
1446
|
+
// CosiSignature
|
|
1447
|
+
export type CosiSignature = {
|
|
1448
|
+
signature: string;
|
|
1449
|
+
};
|
|
1450
|
+
|
|
1426
1451
|
export type Path = {
|
|
1427
1452
|
address_n: number[];
|
|
1428
1453
|
};
|
|
@@ -1441,6 +1466,106 @@ export type EcdsaPublicKeys = {
|
|
|
1441
1466
|
root_fingerprint?: number;
|
|
1442
1467
|
};
|
|
1443
1468
|
|
|
1469
|
+
export enum DebugSwipeDirection {
|
|
1470
|
+
UP = 0,
|
|
1471
|
+
DOWN = 1,
|
|
1472
|
+
LEFT = 2,
|
|
1473
|
+
RIGHT = 3,
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
// DebugLinkDecision
|
|
1477
|
+
export type DebugLinkDecision = {
|
|
1478
|
+
yes_no?: boolean;
|
|
1479
|
+
swipe?: DebugSwipeDirection;
|
|
1480
|
+
input?: string;
|
|
1481
|
+
x?: number;
|
|
1482
|
+
y?: number;
|
|
1483
|
+
wait?: boolean;
|
|
1484
|
+
hold_ms?: number;
|
|
1485
|
+
};
|
|
1486
|
+
|
|
1487
|
+
// DebugLinkLayout
|
|
1488
|
+
export type DebugLinkLayout = {
|
|
1489
|
+
lines: string[];
|
|
1490
|
+
};
|
|
1491
|
+
|
|
1492
|
+
// DebugLinkReseedRandom
|
|
1493
|
+
export type DebugLinkReseedRandom = {
|
|
1494
|
+
value?: number;
|
|
1495
|
+
};
|
|
1496
|
+
|
|
1497
|
+
// DebugLinkRecordScreen
|
|
1498
|
+
export type DebugLinkRecordScreen = {
|
|
1499
|
+
target_directory?: string;
|
|
1500
|
+
};
|
|
1501
|
+
|
|
1502
|
+
// DebugLinkGetState
|
|
1503
|
+
export type DebugLinkGetState = {
|
|
1504
|
+
wait_word_list?: boolean;
|
|
1505
|
+
wait_word_pos?: boolean;
|
|
1506
|
+
wait_layout?: boolean;
|
|
1507
|
+
};
|
|
1508
|
+
|
|
1509
|
+
// DebugLinkState
|
|
1510
|
+
export type DebugLinkState = {
|
|
1511
|
+
layout?: string;
|
|
1512
|
+
pin?: string;
|
|
1513
|
+
matrix?: string;
|
|
1514
|
+
mnemonic_secret?: string;
|
|
1515
|
+
node?: HDNodeType;
|
|
1516
|
+
passphrase_protection?: boolean;
|
|
1517
|
+
reset_word?: string;
|
|
1518
|
+
reset_entropy?: string;
|
|
1519
|
+
recovery_fake_word?: string;
|
|
1520
|
+
recovery_word_pos?: number;
|
|
1521
|
+
reset_word_pos?: number;
|
|
1522
|
+
mnemonic_type?: BackupType;
|
|
1523
|
+
layout_lines: string[];
|
|
1524
|
+
};
|
|
1525
|
+
|
|
1526
|
+
// DebugLinkStop
|
|
1527
|
+
export type DebugLinkStop = {};
|
|
1528
|
+
|
|
1529
|
+
// DebugLinkLog
|
|
1530
|
+
export type DebugLinkLog = {
|
|
1531
|
+
level?: number;
|
|
1532
|
+
bucket?: string;
|
|
1533
|
+
text?: string;
|
|
1534
|
+
};
|
|
1535
|
+
|
|
1536
|
+
// DebugLinkMemoryRead
|
|
1537
|
+
export type DebugLinkMemoryRead = {
|
|
1538
|
+
address?: number;
|
|
1539
|
+
length?: number;
|
|
1540
|
+
};
|
|
1541
|
+
|
|
1542
|
+
// DebugLinkMemory
|
|
1543
|
+
export type DebugLinkMemory = {
|
|
1544
|
+
memory?: string;
|
|
1545
|
+
};
|
|
1546
|
+
|
|
1547
|
+
// DebugLinkMemoryWrite
|
|
1548
|
+
export type DebugLinkMemoryWrite = {
|
|
1549
|
+
address?: number;
|
|
1550
|
+
memory?: string;
|
|
1551
|
+
flash?: boolean;
|
|
1552
|
+
};
|
|
1553
|
+
|
|
1554
|
+
// DebugLinkFlashErase
|
|
1555
|
+
export type DebugLinkFlashErase = {
|
|
1556
|
+
sector?: number;
|
|
1557
|
+
};
|
|
1558
|
+
|
|
1559
|
+
// DebugLinkEraseSdCard
|
|
1560
|
+
export type DebugLinkEraseSdCard = {
|
|
1561
|
+
format?: boolean;
|
|
1562
|
+
};
|
|
1563
|
+
|
|
1564
|
+
// DebugLinkWatchLayout
|
|
1565
|
+
export type DebugLinkWatchLayout = {
|
|
1566
|
+
watch?: boolean;
|
|
1567
|
+
};
|
|
1568
|
+
|
|
1444
1569
|
// DnxGetAddress
|
|
1445
1570
|
export type DnxGetAddress = {
|
|
1446
1571
|
address_n: number[];
|
|
@@ -2679,6 +2804,19 @@ export type Entropy = {
|
|
|
2679
2804
|
// WipeDevice
|
|
2680
2805
|
export type WipeDevice = {};
|
|
2681
2806
|
|
|
2807
|
+
// LoadDevice
|
|
2808
|
+
export type LoadDevice = {
|
|
2809
|
+
mnemonics: string[];
|
|
2810
|
+
pin?: string;
|
|
2811
|
+
passphrase_protection?: boolean;
|
|
2812
|
+
language?: string;
|
|
2813
|
+
label?: string;
|
|
2814
|
+
skip_checksum?: boolean;
|
|
2815
|
+
u2f_counter?: number;
|
|
2816
|
+
needs_backup?: boolean;
|
|
2817
|
+
no_backup?: boolean;
|
|
2818
|
+
};
|
|
2819
|
+
|
|
2682
2820
|
// ResetDevice
|
|
2683
2821
|
export type ResetDevice = {
|
|
2684
2822
|
display_random?: boolean;
|
|
@@ -3354,6 +3492,26 @@ export type MoneroLiveRefreshFinalRequest = {};
|
|
|
3354
3492
|
// MoneroLiveRefreshFinalAck
|
|
3355
3493
|
export type MoneroLiveRefreshFinalAck = {};
|
|
3356
3494
|
|
|
3495
|
+
// DebugMoneroDiagRequest
|
|
3496
|
+
export type DebugMoneroDiagRequest = {
|
|
3497
|
+
ins?: number;
|
|
3498
|
+
p1?: number;
|
|
3499
|
+
p2?: number;
|
|
3500
|
+
pd: number[];
|
|
3501
|
+
data1?: string;
|
|
3502
|
+
data2?: string;
|
|
3503
|
+
};
|
|
3504
|
+
|
|
3505
|
+
// DebugMoneroDiagAck
|
|
3506
|
+
export type DebugMoneroDiagAck = {
|
|
3507
|
+
ins?: number;
|
|
3508
|
+
p1?: number;
|
|
3509
|
+
p2?: number;
|
|
3510
|
+
pd: number[];
|
|
3511
|
+
data1?: string;
|
|
3512
|
+
data2?: string;
|
|
3513
|
+
};
|
|
3514
|
+
|
|
3357
3515
|
// NearGetAddress
|
|
3358
3516
|
export type NearGetAddress = {
|
|
3359
3517
|
address_n: number[];
|
|
@@ -4542,6 +4700,39 @@ export type TronMessageSignature = {
|
|
|
4542
4700
|
signature: string;
|
|
4543
4701
|
};
|
|
4544
4702
|
|
|
4703
|
+
// WebAuthnListResidentCredentials
|
|
4704
|
+
export type WebAuthnListResidentCredentials = {};
|
|
4705
|
+
|
|
4706
|
+
// WebAuthnAddResidentCredential
|
|
4707
|
+
export type WebAuthnAddResidentCredential = {
|
|
4708
|
+
credential_id?: string;
|
|
4709
|
+
};
|
|
4710
|
+
|
|
4711
|
+
// WebAuthnRemoveResidentCredential
|
|
4712
|
+
export type WebAuthnRemoveResidentCredential = {
|
|
4713
|
+
index?: number;
|
|
4714
|
+
};
|
|
4715
|
+
|
|
4716
|
+
export type WebAuthnCredential = {
|
|
4717
|
+
index?: number;
|
|
4718
|
+
id?: string;
|
|
4719
|
+
rp_id?: string;
|
|
4720
|
+
rp_name?: string;
|
|
4721
|
+
user_id?: string;
|
|
4722
|
+
user_name?: string;
|
|
4723
|
+
user_display_name?: string;
|
|
4724
|
+
creation_time?: number;
|
|
4725
|
+
hmac_secret?: boolean;
|
|
4726
|
+
use_sign_count?: boolean;
|
|
4727
|
+
algorithm?: number;
|
|
4728
|
+
curve?: number;
|
|
4729
|
+
};
|
|
4730
|
+
|
|
4731
|
+
// WebAuthnCredentials
|
|
4732
|
+
export type WebAuthnCredentials = {
|
|
4733
|
+
credentials: WebAuthnCredential[];
|
|
4734
|
+
};
|
|
4735
|
+
|
|
4545
4736
|
// facotry
|
|
4546
4737
|
export type facotry = {};
|
|
4547
4738
|
|
|
@@ -5449,9 +5640,27 @@ export type MessageType = {
|
|
|
5449
5640
|
SignedIdentity: SignedIdentity;
|
|
5450
5641
|
GetECDHSessionKey: GetECDHSessionKey;
|
|
5451
5642
|
ECDHSessionKey: ECDHSessionKey;
|
|
5643
|
+
CosiCommit: CosiCommit;
|
|
5644
|
+
CosiCommitment: CosiCommitment;
|
|
5645
|
+
CosiSign: CosiSign;
|
|
5646
|
+
CosiSignature: CosiSignature;
|
|
5452
5647
|
Path: Path;
|
|
5453
5648
|
BatchGetPublickeys: BatchGetPublickeys;
|
|
5454
5649
|
EcdsaPublicKeys: EcdsaPublicKeys;
|
|
5650
|
+
DebugLinkDecision: DebugLinkDecision;
|
|
5651
|
+
DebugLinkLayout: DebugLinkLayout;
|
|
5652
|
+
DebugLinkReseedRandom: DebugLinkReseedRandom;
|
|
5653
|
+
DebugLinkRecordScreen: DebugLinkRecordScreen;
|
|
5654
|
+
DebugLinkGetState: DebugLinkGetState;
|
|
5655
|
+
DebugLinkState: DebugLinkState;
|
|
5656
|
+
DebugLinkStop: DebugLinkStop;
|
|
5657
|
+
DebugLinkLog: DebugLinkLog;
|
|
5658
|
+
DebugLinkMemoryRead: DebugLinkMemoryRead;
|
|
5659
|
+
DebugLinkMemory: DebugLinkMemory;
|
|
5660
|
+
DebugLinkMemoryWrite: DebugLinkMemoryWrite;
|
|
5661
|
+
DebugLinkFlashErase: DebugLinkFlashErase;
|
|
5662
|
+
DebugLinkEraseSdCard: DebugLinkEraseSdCard;
|
|
5663
|
+
DebugLinkWatchLayout: DebugLinkWatchLayout;
|
|
5455
5664
|
DnxGetAddress: DnxGetAddress;
|
|
5456
5665
|
DnxAddress: DnxAddress;
|
|
5457
5666
|
DnxSignTx: DnxSignTx;
|
|
@@ -5589,6 +5798,7 @@ export type MessageType = {
|
|
|
5589
5798
|
GetEntropy: GetEntropy;
|
|
5590
5799
|
Entropy: Entropy;
|
|
5591
5800
|
WipeDevice: WipeDevice;
|
|
5801
|
+
LoadDevice: LoadDevice;
|
|
5592
5802
|
ResetDevice: ResetDevice;
|
|
5593
5803
|
BackupDevice: BackupDevice;
|
|
5594
5804
|
EntropyRequest: EntropyRequest;
|
|
@@ -5696,6 +5906,8 @@ export type MessageType = {
|
|
|
5696
5906
|
MoneroLiveRefreshStepAck: MoneroLiveRefreshStepAck;
|
|
5697
5907
|
MoneroLiveRefreshFinalRequest: MoneroLiveRefreshFinalRequest;
|
|
5698
5908
|
MoneroLiveRefreshFinalAck: MoneroLiveRefreshFinalAck;
|
|
5909
|
+
DebugMoneroDiagRequest: DebugMoneroDiagRequest;
|
|
5910
|
+
DebugMoneroDiagAck: DebugMoneroDiagAck;
|
|
5699
5911
|
NearGetAddress: NearGetAddress;
|
|
5700
5912
|
NearAddress: NearAddress;
|
|
5701
5913
|
NearSignTx: NearSignTx;
|
|
@@ -5850,6 +6062,11 @@ export type MessageType = {
|
|
|
5850
6062
|
TronSignedTx: TronSignedTx;
|
|
5851
6063
|
TronSignMessage: TronSignMessage;
|
|
5852
6064
|
TronMessageSignature: TronMessageSignature;
|
|
6065
|
+
WebAuthnListResidentCredentials: WebAuthnListResidentCredentials;
|
|
6066
|
+
WebAuthnAddResidentCredential: WebAuthnAddResidentCredential;
|
|
6067
|
+
WebAuthnRemoveResidentCredential: WebAuthnRemoveResidentCredential;
|
|
6068
|
+
WebAuthnCredential: WebAuthnCredential;
|
|
6069
|
+
WebAuthnCredentials: WebAuthnCredentials;
|
|
5853
6070
|
facotry: facotry;
|
|
5854
6071
|
experimental_message: experimental_message;
|
|
5855
6072
|
experimental_field: experimental_field;
|
package/src/types/transport.ts
CHANGED
|
@@ -63,6 +63,8 @@ export type TransportCallOptions = {
|
|
|
63
63
|
expectedTypes?: string[];
|
|
64
64
|
intermediateTypes?: string[];
|
|
65
65
|
onIntermediateResponse?: (response: MessageFromOneKey) => void;
|
|
66
|
+
/** Prefer acknowledged BLE characteristic writes for this call when supported. */
|
|
67
|
+
writeWithResponse?: boolean;
|
|
66
68
|
};
|
|
67
69
|
|
|
68
70
|
type ITransportInitFn = (
|