@onekeyfe/hd-transport 1.2.2-alpha.0 → 1.2.2-alpha.10
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 +62 -18
- package/__tests__/protocol-v2.test.js +34 -3
- package/dist/index.d.ts +62 -17
- package/dist/types/messages.d.ts +42 -9
- 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/messages-protocol-v2.json +1471 -1367
- package/package.json +2 -2
- package/src/constants.ts +1 -1
- package/src/types/messages.ts +57 -14
- package/src/types/transport.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport",
|
|
3
|
-
"version": "1.2.2-alpha.
|
|
3
|
+
"version": "1.2.2-alpha.10",
|
|
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": "d20768b7fa33a0aaf42fd65691c2ef7fdae7d7c2"
|
|
32
32
|
}
|
package/src/constants.ts
CHANGED
|
@@ -26,7 +26,7 @@ export const PROTOCOL_V2_FRAME_MAX_BYTES = 4200;
|
|
|
26
26
|
/** FilesystemFileWrite chunk size over WebUSB. */
|
|
27
27
|
export const PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE = 4000;
|
|
28
28
|
|
|
29
|
-
/** FilesystemFileWrite chunk size over BLE. */
|
|
29
|
+
/** Generic FilesystemFileWrite chunk size over BLE, including support for long filesystem paths. */
|
|
30
30
|
export const PROTOCOL_V2_BLE_FILE_CHUNK_SIZE = 1800;
|
|
31
31
|
|
|
32
32
|
/**
|
package/src/types/messages.ts
CHANGED
|
@@ -4558,12 +4558,6 @@ export enum CommandFlags {
|
|
|
4558
4558
|
Factory_Only = 1,
|
|
4559
4559
|
}
|
|
4560
4560
|
|
|
4561
|
-
// experimental_message
|
|
4562
|
-
export type experimental_message = {};
|
|
4563
|
-
|
|
4564
|
-
// experimental_field
|
|
4565
|
-
export type experimental_field = {};
|
|
4566
|
-
|
|
4567
4561
|
export type TextMemo = {
|
|
4568
4562
|
text: string;
|
|
4569
4563
|
};
|
|
@@ -4669,6 +4663,12 @@ export type UiAnimationRequest = {
|
|
|
4669
4663
|
type?: UiAnimationType;
|
|
4670
4664
|
};
|
|
4671
4665
|
|
|
4666
|
+
// experimental_message
|
|
4667
|
+
export type experimental_message = {};
|
|
4668
|
+
|
|
4669
|
+
// experimental_field
|
|
4670
|
+
export type experimental_field = {};
|
|
4671
|
+
|
|
4672
4672
|
// ProtocolInfoRequest
|
|
4673
4673
|
export type ProtocolInfoRequest = {
|
|
4674
4674
|
eventless_wallet_session?: boolean;
|
|
@@ -5032,13 +5032,13 @@ export enum DeviceSessionSeedDomain {
|
|
|
5032
5032
|
export type DeviceSessionGet = {
|
|
5033
5033
|
session_id?: string;
|
|
5034
5034
|
btc_test_address?: string;
|
|
5035
|
-
seed_domains: DeviceSessionSeedDomain[];
|
|
5036
5035
|
};
|
|
5037
5036
|
|
|
5038
5037
|
// DeviceSession
|
|
5039
5038
|
export type DeviceSession = {
|
|
5040
5039
|
session_id?: string;
|
|
5041
5040
|
btc_test_address?: string;
|
|
5041
|
+
seed_domains: DeviceSessionSeedDomain[];
|
|
5042
5042
|
};
|
|
5043
5043
|
|
|
5044
5044
|
export enum DeviceSessionPinType {
|
|
@@ -5056,6 +5056,7 @@ export type DeviceSessionAskPin = {
|
|
|
5056
5056
|
export type DeviceSessionAskPassphrase = {
|
|
5057
5057
|
passphrase?: string;
|
|
5058
5058
|
on_device: boolean;
|
|
5059
|
+
seed_domains: DeviceSessionSeedDomain[];
|
|
5059
5060
|
};
|
|
5060
5061
|
|
|
5061
5062
|
export enum DeviceSessionAskPin_FailureSubCodes {
|
|
@@ -5247,6 +5248,12 @@ export type ViewDetail = {
|
|
|
5247
5248
|
has_icon: boolean;
|
|
5248
5249
|
};
|
|
5249
5250
|
|
|
5251
|
+
// ViewCustomField
|
|
5252
|
+
export type ViewCustomField = {
|
|
5253
|
+
key: string;
|
|
5254
|
+
value: string;
|
|
5255
|
+
};
|
|
5256
|
+
|
|
5250
5257
|
export enum ViewTipType {
|
|
5251
5258
|
Default = 0,
|
|
5252
5259
|
Highlight = 1,
|
|
@@ -5263,10 +5270,30 @@ export type ViewTip = {
|
|
|
5263
5270
|
text_arg?: string;
|
|
5264
5271
|
};
|
|
5265
5272
|
|
|
5266
|
-
//
|
|
5267
|
-
export type
|
|
5273
|
+
// ViewActionCard
|
|
5274
|
+
export type ViewActionCard = {
|
|
5268
5275
|
initial_data: string;
|
|
5269
|
-
|
|
5276
|
+
};
|
|
5277
|
+
|
|
5278
|
+
// ViewContentPreview
|
|
5279
|
+
export type ViewContentPreview = {
|
|
5280
|
+
content_key: number;
|
|
5281
|
+
preview: string;
|
|
5282
|
+
total_bytes?: number;
|
|
5283
|
+
};
|
|
5284
|
+
|
|
5285
|
+
// ViewContentEntry
|
|
5286
|
+
export type ViewContentEntry = {
|
|
5287
|
+
entry_key: number;
|
|
5288
|
+
value: string;
|
|
5289
|
+
};
|
|
5290
|
+
|
|
5291
|
+
// ViewContentPage
|
|
5292
|
+
export type ViewContentPage = {
|
|
5293
|
+
page_index: number;
|
|
5294
|
+
page_count: number;
|
|
5295
|
+
chunk?: string;
|
|
5296
|
+
entry?: ViewContentEntry;
|
|
5270
5297
|
};
|
|
5271
5298
|
|
|
5272
5299
|
export enum ViewSignLayout {
|
|
@@ -5284,11 +5311,21 @@ export type ViewSignPage = {
|
|
|
5284
5311
|
amount?: UintType;
|
|
5285
5312
|
general: ViewDetail[];
|
|
5286
5313
|
tip?: ViewTip;
|
|
5287
|
-
|
|
5314
|
+
action_card?: ViewActionCard;
|
|
5288
5315
|
slide_to_confirm?: boolean;
|
|
5289
5316
|
layout?: ViewSignLayout;
|
|
5290
5317
|
title_id?: number;
|
|
5291
5318
|
title_arg?: string;
|
|
5319
|
+
content?: ViewContentPreview;
|
|
5320
|
+
custom_field?: ViewCustomField;
|
|
5321
|
+
};
|
|
5322
|
+
|
|
5323
|
+
// ViewWarningPage
|
|
5324
|
+
export type ViewWarningPage = {
|
|
5325
|
+
title_id: number;
|
|
5326
|
+
text_id: number;
|
|
5327
|
+
text_arg?: string;
|
|
5328
|
+
cancellable?: boolean;
|
|
5292
5329
|
};
|
|
5293
5330
|
|
|
5294
5331
|
// ViewVerifyPage
|
|
@@ -5301,6 +5338,7 @@ export type ViewVerifyPage = {
|
|
|
5301
5338
|
value_key?: number;
|
|
5302
5339
|
title_id?: number;
|
|
5303
5340
|
chain_id?: number;
|
|
5341
|
+
content?: ViewContentPreview;
|
|
5304
5342
|
};
|
|
5305
5343
|
|
|
5306
5344
|
export enum ProtocolV2FailureType {
|
|
@@ -5900,8 +5938,6 @@ export type MessageType = {
|
|
|
5900
5938
|
TronSignMessage: TronSignMessage;
|
|
5901
5939
|
TronMessageSignature: TronMessageSignature;
|
|
5902
5940
|
facotry: facotry;
|
|
5903
|
-
experimental_message: experimental_message;
|
|
5904
|
-
experimental_field: experimental_field;
|
|
5905
5941
|
TextMemo: TextMemo;
|
|
5906
5942
|
RefundMemo: RefundMemo;
|
|
5907
5943
|
CoinPurchaseMemo: CoinPurchaseMemo;
|
|
@@ -5917,6 +5953,8 @@ export type MessageType = {
|
|
|
5917
5953
|
UnlockPath: UnlockPath;
|
|
5918
5954
|
UnlockedPathRequest: UnlockedPathRequest;
|
|
5919
5955
|
UiAnimationRequest: UiAnimationRequest;
|
|
5956
|
+
experimental_message: experimental_message;
|
|
5957
|
+
experimental_field: experimental_field;
|
|
5920
5958
|
ProtocolInfoRequest: ProtocolInfoRequest;
|
|
5921
5959
|
ProtocolInfo: ProtocolInfo;
|
|
5922
5960
|
DeviceReboot: DeviceReboot;
|
|
@@ -5981,9 +6019,14 @@ export type MessageType = {
|
|
|
5981
6019
|
PortfolioUpdate: PortfolioUpdate;
|
|
5982
6020
|
ViewAmount: ViewAmount;
|
|
5983
6021
|
ViewDetail: ViewDetail;
|
|
6022
|
+
ViewCustomField: ViewCustomField;
|
|
5984
6023
|
ViewTip: ViewTip;
|
|
5985
|
-
|
|
6024
|
+
ViewActionCard: ViewActionCard;
|
|
6025
|
+
ViewContentPreview: ViewContentPreview;
|
|
6026
|
+
ViewContentEntry: ViewContentEntry;
|
|
6027
|
+
ViewContentPage: ViewContentPage;
|
|
5986
6028
|
ViewSignPage: ViewSignPage;
|
|
6029
|
+
ViewWarningPage: ViewWarningPage;
|
|
5987
6030
|
ViewVerifyPage: ViewVerifyPage;
|
|
5988
6031
|
};
|
|
5989
6032
|
|
package/src/types/transport.ts
CHANGED
|
@@ -145,6 +145,8 @@ export type LowlevelTransportSharedPlugin = {
|
|
|
145
145
|
receive: (uuid?: string) => Promise<string>;
|
|
146
146
|
connect: (uuid: string) => Promise<void>;
|
|
147
147
|
disconnect: (uuid: string) => Promise<void>;
|
|
148
|
+
/** Maximum Protocol V2 bytes accepted by one BLE characteristic write. */
|
|
149
|
+
getProtocolV2PacketCapacity?: (uuid: string) => number | undefined | Promise<number | undefined>;
|
|
148
150
|
|
|
149
151
|
init: () => Promise<void>;
|
|
150
152
|
version: string;
|