@onekeyfe/hd-transport 1.2.0-alpha.22 → 1.2.0-alpha.24
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__/messages.test.js +22 -19
- package/dist/index.d.ts +54 -36
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -0
- package/dist/types/messages.d.ts +30 -23
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/transport.d.ts +8 -0
- package/dist/types/transport.d.ts.map +1 -1
- package/messages-protocol-v2.json +49 -56
- package/package.json +2 -2
- package/src/index.ts +2 -1
- package/src/types/messages.ts +38 -34
- package/src/types/transport.ts +10 -0
|
@@ -482,9 +482,10 @@
|
|
|
482
482
|
"MessageType_DeviceStatus": 60603,
|
|
483
483
|
"MessageType_DevGetOnboardingStatus": 60604,
|
|
484
484
|
"MessageType_DevOnboardingStatus": 60605,
|
|
485
|
+
"MessageType_DeviceSessionGet": 60606,
|
|
485
486
|
"MessageType_DeviceSession": 60607,
|
|
486
487
|
"MessageType_DeviceSessionAskPin": 60608,
|
|
487
|
-
"
|
|
488
|
+
"MessageType_DeviceSessionAskPassphrase": 60609,
|
|
488
489
|
"MessageType_FilesystemPermissionFix": 60800,
|
|
489
490
|
"MessageType_FilesystemPathInfo": 60801,
|
|
490
491
|
"MessageType_FilesystemPathInfoQuery": 60802,
|
|
@@ -506,8 +507,7 @@
|
|
|
506
507
|
[90, 92],
|
|
507
508
|
[114, 122],
|
|
508
509
|
[300, 304],
|
|
509
|
-
[309, 312]
|
|
510
|
-
[60606, 60606]
|
|
510
|
+
[309, 312]
|
|
511
511
|
]
|
|
512
512
|
},
|
|
513
513
|
"AlephiumGetAddress": {
|
|
@@ -11506,6 +11506,33 @@
|
|
|
11506
11506
|
}
|
|
11507
11507
|
}
|
|
11508
11508
|
},
|
|
11509
|
+
"UiAnimationType": {
|
|
11510
|
+
"values": {
|
|
11511
|
+
"Unknown": 0,
|
|
11512
|
+
"Signing": 1
|
|
11513
|
+
}
|
|
11514
|
+
},
|
|
11515
|
+
"UiAnimationCommand": {
|
|
11516
|
+
"values": {
|
|
11517
|
+
"CommandUnknown": 0,
|
|
11518
|
+
"Start": 1,
|
|
11519
|
+
"Stop": 2,
|
|
11520
|
+
"Refresh": 3
|
|
11521
|
+
}
|
|
11522
|
+
},
|
|
11523
|
+
"UiAnimationRequest": {
|
|
11524
|
+
"fields": {
|
|
11525
|
+
"command": {
|
|
11526
|
+
"rule": "required",
|
|
11527
|
+
"type": "UiAnimationCommand",
|
|
11528
|
+
"id": 1
|
|
11529
|
+
},
|
|
11530
|
+
"type": {
|
|
11531
|
+
"type": "UiAnimationType",
|
|
11532
|
+
"id": 2
|
|
11533
|
+
}
|
|
11534
|
+
}
|
|
11535
|
+
},
|
|
11509
11536
|
"ViewAmount": {
|
|
11510
11537
|
"fields": {
|
|
11511
11538
|
"is_unlimited": {
|
|
@@ -12446,83 +12473,49 @@
|
|
|
12446
12473
|
"DeviceSessionError_Busy": 5
|
|
12447
12474
|
}
|
|
12448
12475
|
},
|
|
12449
|
-
"
|
|
12476
|
+
"DeviceSessionGet": {
|
|
12450
12477
|
"fields": {
|
|
12451
12478
|
"session_id": {
|
|
12452
|
-
"rule": "required",
|
|
12453
12479
|
"type": "bytes",
|
|
12454
12480
|
"id": 1
|
|
12455
12481
|
}
|
|
12456
12482
|
}
|
|
12457
12483
|
},
|
|
12458
|
-
"
|
|
12459
|
-
"fields": {
|
|
12460
|
-
"passphrase": {
|
|
12461
|
-
"rule": "required",
|
|
12462
|
-
"type": "string",
|
|
12463
|
-
"id": 1
|
|
12464
|
-
}
|
|
12465
|
-
}
|
|
12466
|
-
},
|
|
12467
|
-
"DeviceSessionPassphraseOnDevice": {
|
|
12468
|
-
"fields": {}
|
|
12469
|
-
},
|
|
12470
|
-
"DeviceSessionAttachPinOnDevice": {
|
|
12471
|
-
"fields": {}
|
|
12472
|
-
},
|
|
12473
|
-
"DeviceSessionSelect": {
|
|
12474
|
-
"oneofs": {
|
|
12475
|
-
"access": {
|
|
12476
|
-
"oneof": ["host_passphrase", "passphrase_on_device", "attach_pin_on_device"]
|
|
12477
|
-
}
|
|
12478
|
-
},
|
|
12484
|
+
"DeviceSession": {
|
|
12479
12485
|
"fields": {
|
|
12480
|
-
"
|
|
12481
|
-
"type": "
|
|
12486
|
+
"session_id": {
|
|
12487
|
+
"type": "bytes",
|
|
12482
12488
|
"id": 1
|
|
12483
12489
|
},
|
|
12484
|
-
"
|
|
12485
|
-
"type": "
|
|
12490
|
+
"btc_test_address": {
|
|
12491
|
+
"type": "string",
|
|
12486
12492
|
"id": 2
|
|
12487
|
-
},
|
|
12488
|
-
"attach_pin_on_device": {
|
|
12489
|
-
"type": "DeviceSessionAttachPinOnDevice",
|
|
12490
|
-
"id": 3
|
|
12491
12493
|
}
|
|
12492
12494
|
}
|
|
12493
12495
|
},
|
|
12494
|
-
"
|
|
12495
|
-
"
|
|
12496
|
-
"
|
|
12497
|
-
|
|
12498
|
-
|
|
12499
|
-
}
|
|
12496
|
+
"DeviceSessionPinType": {
|
|
12497
|
+
"values": {
|
|
12498
|
+
"Any": 1,
|
|
12499
|
+
"Main": 2,
|
|
12500
|
+
"AttachToPin": 3
|
|
12501
|
+
}
|
|
12502
|
+
},
|
|
12503
|
+
"DeviceSessionAskPin": {
|
|
12500
12504
|
"fields": {
|
|
12501
|
-
"
|
|
12502
|
-
"type": "
|
|
12505
|
+
"type": {
|
|
12506
|
+
"type": "DeviceSessionPinType",
|
|
12503
12507
|
"id": 1
|
|
12504
|
-
},
|
|
12505
|
-
"select": {
|
|
12506
|
-
"type": "DeviceSessionSelect",
|
|
12507
|
-
"id": 2
|
|
12508
12508
|
}
|
|
12509
12509
|
}
|
|
12510
12510
|
},
|
|
12511
|
-
"
|
|
12511
|
+
"DeviceSessionAskPassphrase": {
|
|
12512
12512
|
"fields": {
|
|
12513
|
-
"
|
|
12514
|
-
"type": "bytes",
|
|
12515
|
-
"id": 1
|
|
12516
|
-
},
|
|
12517
|
-
"btc_test_address": {
|
|
12513
|
+
"passphrase": {
|
|
12518
12514
|
"type": "string",
|
|
12519
|
-
"id":
|
|
12515
|
+
"id": 1
|
|
12520
12516
|
}
|
|
12521
12517
|
}
|
|
12522
12518
|
},
|
|
12523
|
-
"DeviceSessionAskPin": {
|
|
12524
|
-
"fields": {}
|
|
12525
|
-
},
|
|
12526
12519
|
"DeviceSessionAskPin_FailureSubCodes": {
|
|
12527
12520
|
"values": {
|
|
12528
12521
|
"UserCancel": 1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.24",
|
|
4
4
|
"description": "Transport layer abstractions and utilities for OneKey hardware SDK.",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"long": "^4.0.0",
|
|
29
29
|
"protobufjs": "^6.11.2"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "43663337d94350430cc507c74d6eec5a076bd4e9"
|
|
32
32
|
}
|
package/src/index.ts
CHANGED
|
@@ -41,9 +41,10 @@ export type {
|
|
|
41
41
|
OneKeyDeviceInfoBase,
|
|
42
42
|
OneKeyDeviceCommType,
|
|
43
43
|
ProtocolType,
|
|
44
|
+
TransportDeviceDisconnectEvent,
|
|
44
45
|
} from './types';
|
|
45
46
|
|
|
46
|
-
export { Messages } from './types';
|
|
47
|
+
export { Messages, TRANSPORT_EVENT } from './types';
|
|
47
48
|
export * from './types/messages';
|
|
48
49
|
export * from './utils/logBlockCommand';
|
|
49
50
|
|
package/src/types/messages.ts
CHANGED
|
@@ -4679,6 +4679,24 @@ export enum MoneroNetworkType {
|
|
|
4679
4679
|
FAKECHAIN = 3,
|
|
4680
4680
|
}
|
|
4681
4681
|
|
|
4682
|
+
export enum UiAnimationType {
|
|
4683
|
+
Unknown = 0,
|
|
4684
|
+
Signing = 1,
|
|
4685
|
+
}
|
|
4686
|
+
|
|
4687
|
+
export enum UiAnimationCommand {
|
|
4688
|
+
CommandUnknown = 0,
|
|
4689
|
+
Start = 1,
|
|
4690
|
+
Stop = 2,
|
|
4691
|
+
Refresh = 3,
|
|
4692
|
+
}
|
|
4693
|
+
|
|
4694
|
+
// UiAnimationRequest
|
|
4695
|
+
export type UiAnimationRequest = {
|
|
4696
|
+
command: UiAnimationCommand;
|
|
4697
|
+
type?: UiAnimationType;
|
|
4698
|
+
};
|
|
4699
|
+
|
|
4682
4700
|
// ViewAmount
|
|
4683
4701
|
export type ViewAmount = {
|
|
4684
4702
|
is_unlimited: boolean;
|
|
@@ -5060,33 +5078,9 @@ export enum DeviceSessionErrorCode {
|
|
|
5060
5078
|
DeviceSessionError_Busy = 5,
|
|
5061
5079
|
}
|
|
5062
5080
|
|
|
5063
|
-
//
|
|
5064
|
-
export type
|
|
5065
|
-
session_id
|
|
5066
|
-
};
|
|
5067
|
-
|
|
5068
|
-
// DeviceSessionHostPassphrase
|
|
5069
|
-
export type DeviceSessionHostPassphrase = {
|
|
5070
|
-
passphrase: string;
|
|
5071
|
-
};
|
|
5072
|
-
|
|
5073
|
-
// DeviceSessionPassphraseOnDevice
|
|
5074
|
-
export type DeviceSessionPassphraseOnDevice = {};
|
|
5075
|
-
|
|
5076
|
-
// DeviceSessionAttachPinOnDevice
|
|
5077
|
-
export type DeviceSessionAttachPinOnDevice = {};
|
|
5078
|
-
|
|
5079
|
-
// DeviceSessionSelect
|
|
5080
|
-
export type DeviceSessionSelect = {
|
|
5081
|
-
host_passphrase?: DeviceSessionHostPassphrase;
|
|
5082
|
-
passphrase_on_device?: DeviceSessionPassphraseOnDevice;
|
|
5083
|
-
attach_pin_on_device?: DeviceSessionAttachPinOnDevice;
|
|
5084
|
-
};
|
|
5085
|
-
|
|
5086
|
-
// DeviceSessionOpen
|
|
5087
|
-
export type DeviceSessionOpen = {
|
|
5088
|
-
resume?: DeviceSessionResume;
|
|
5089
|
-
select?: DeviceSessionSelect;
|
|
5081
|
+
// DeviceSessionGet
|
|
5082
|
+
export type DeviceSessionGet = {
|
|
5083
|
+
session_id?: string;
|
|
5090
5084
|
};
|
|
5091
5085
|
|
|
5092
5086
|
// DeviceSession
|
|
@@ -5095,8 +5089,21 @@ export type DeviceSession = {
|
|
|
5095
5089
|
btc_test_address?: string;
|
|
5096
5090
|
};
|
|
5097
5091
|
|
|
5092
|
+
export enum DeviceSessionPinType {
|
|
5093
|
+
Any = 1,
|
|
5094
|
+
Main = 2,
|
|
5095
|
+
AttachToPin = 3,
|
|
5096
|
+
}
|
|
5097
|
+
|
|
5098
5098
|
// DeviceSessionAskPin
|
|
5099
|
-
export type DeviceSessionAskPin = {
|
|
5099
|
+
export type DeviceSessionAskPin = {
|
|
5100
|
+
type?: DeviceSessionPinType;
|
|
5101
|
+
};
|
|
5102
|
+
|
|
5103
|
+
// DeviceSessionAskPassphrase
|
|
5104
|
+
export type DeviceSessionAskPassphrase = {
|
|
5105
|
+
passphrase?: string;
|
|
5106
|
+
};
|
|
5100
5107
|
|
|
5101
5108
|
export enum DeviceSessionAskPin_FailureSubCodes {
|
|
5102
5109
|
UserCancel = 1,
|
|
@@ -5878,6 +5885,7 @@ export type MessageType = {
|
|
|
5878
5885
|
Wallpaper: Wallpaper;
|
|
5879
5886
|
UnlockPath: UnlockPath;
|
|
5880
5887
|
UnlockedPathRequest: UnlockedPathRequest;
|
|
5888
|
+
UiAnimationRequest: UiAnimationRequest;
|
|
5881
5889
|
ViewAmount: ViewAmount;
|
|
5882
5890
|
ViewDetail: ViewDetail;
|
|
5883
5891
|
ViewTip: ViewTip;
|
|
@@ -5916,14 +5924,10 @@ export type MessageType = {
|
|
|
5916
5924
|
DeviceInfoTargets: DeviceInfoTargets;
|
|
5917
5925
|
DeviceInfoTypes: DeviceInfoTypes;
|
|
5918
5926
|
DeviceInfoGet: DeviceInfoGet;
|
|
5919
|
-
|
|
5920
|
-
DeviceSessionHostPassphrase: DeviceSessionHostPassphrase;
|
|
5921
|
-
DeviceSessionPassphraseOnDevice: DeviceSessionPassphraseOnDevice;
|
|
5922
|
-
DeviceSessionAttachPinOnDevice: DeviceSessionAttachPinOnDevice;
|
|
5923
|
-
DeviceSessionSelect: DeviceSessionSelect;
|
|
5924
|
-
DeviceSessionOpen: DeviceSessionOpen;
|
|
5927
|
+
DeviceSessionGet: DeviceSessionGet;
|
|
5925
5928
|
DeviceSession: DeviceSession;
|
|
5926
5929
|
DeviceSessionAskPin: DeviceSessionAskPin;
|
|
5930
|
+
DeviceSessionAskPassphrase: DeviceSessionAskPassphrase;
|
|
5927
5931
|
DeviceStatus: DeviceStatus;
|
|
5928
5932
|
DeviceStatusGet: DeviceStatusGet;
|
|
5929
5933
|
DevOnboardingSetupStatus: DevOnboardingSetupStatus;
|
package/src/types/transport.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type EventEmitter from 'events';
|
|
2
2
|
|
|
3
|
+
export const TRANSPORT_EVENT = {
|
|
4
|
+
DEVICE_DISCONNECT: 'transport-device-disconnect',
|
|
5
|
+
} as const;
|
|
6
|
+
|
|
7
|
+
export type TransportDeviceDisconnectEvent = {
|
|
8
|
+
id: string;
|
|
9
|
+
connectId: string;
|
|
10
|
+
name: string | null;
|
|
11
|
+
};
|
|
12
|
+
|
|
3
13
|
export type ProtocolType = 'V1' | 'V2';
|
|
4
14
|
|
|
5
15
|
export type OneKeyDeviceCommType =
|