@onekeyfe/hd-transport 1.1.27-alpha.35 → 1.1.27-alpha.37
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 +17 -4
- package/dist/index.d.ts +88 -42
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +91 -12
- package/dist/protocols/index.d.ts +5 -1
- package/dist/protocols/index.d.ts.map +1 -1
- package/dist/protocols/v2/debug.d.ts +13 -0
- package/dist/protocols/v2/debug.d.ts.map +1 -0
- package/dist/protocols/v2/decode.d.ts +2 -1
- package/dist/protocols/v2/decode.d.ts.map +1 -1
- package/dist/protocols/v2/encode.d.ts +3 -2
- package/dist/protocols/v2/encode.d.ts.map +1 -1
- package/dist/protocols/v2/index.d.ts +1 -0
- package/dist/protocols/v2/index.d.ts.map +1 -1
- package/dist/protocols/v2/session.d.ts.map +1 -1
- package/dist/types/messages.d.ts +14 -2
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/transport.d.ts +1 -1
- package/dist/types/transport.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/protocols/index.ts +37 -3
- package/src/protocols/v2/debug.ts +26 -0
- package/src/protocols/v2/decode.ts +21 -1
- package/src/protocols/v2/encode.ts +32 -6
- package/src/protocols/v2/index.ts +1 -0
- package/src/protocols/v2/session.ts +9 -2
- package/src/types/messages.ts +15 -2
- package/src/types/transport.ts +3 -2
|
@@ -316,6 +316,21 @@ describe('Protocol V2 framing and session', () => {
|
|
|
316
316
|
expect(logger.debug).toHaveBeenCalledWith('[ProtocolV2 Test] TX payload name=Ping', {
|
|
317
317
|
message: 'hello',
|
|
318
318
|
});
|
|
319
|
+
expect(logger.debug).toHaveBeenCalledWith(
|
|
320
|
+
'[ProtocolV2 Test] encode raw frame',
|
|
321
|
+
expect.objectContaining({
|
|
322
|
+
context: 'tx:Ping',
|
|
323
|
+
messageTypeId: 60206,
|
|
324
|
+
router: 1,
|
|
325
|
+
})
|
|
326
|
+
);
|
|
327
|
+
expect(logger.debug).toHaveBeenCalledWith(
|
|
328
|
+
'[ProtocolV2 Test] decode raw frame',
|
|
329
|
+
expect.objectContaining({
|
|
330
|
+
context: 'rx:Ping',
|
|
331
|
+
messageTypeId: 60207,
|
|
332
|
+
})
|
|
333
|
+
);
|
|
319
334
|
expect(logger.debug).toHaveBeenCalledWith(
|
|
320
335
|
'[ProtocolV2 Test] RX payload type=Success messageTypeId=60207',
|
|
321
336
|
{
|
|
@@ -324,7 +339,7 @@ describe('Protocol V2 framing and session', () => {
|
|
|
324
339
|
);
|
|
325
340
|
});
|
|
326
341
|
|
|
327
|
-
test('session suppresses
|
|
342
|
+
test('session suppresses debug logs for file transfer calls', async () => {
|
|
328
343
|
const response = ProtocolV2.encodeFrame(schemas, 'Success', {
|
|
329
344
|
message: 'ok',
|
|
330
345
|
});
|
|
@@ -346,9 +361,7 @@ describe('Protocol V2 framing and session', () => {
|
|
|
346
361
|
},
|
|
347
362
|
});
|
|
348
363
|
|
|
349
|
-
expect(logger.debug.
|
|
350
|
-
false
|
|
351
|
-
);
|
|
364
|
+
expect(logger.debug).not.toHaveBeenCalled();
|
|
352
365
|
});
|
|
353
366
|
|
|
354
367
|
test('session skips unrelated terminal frames when expected response types are provided', async () => {
|
package/dist/index.d.ts
CHANGED
|
@@ -54,40 +54,6 @@ declare namespace index {
|
|
|
54
54
|
|
|
55
55
|
declare function parseConfigure(data: protobuf.INamespace): protobuf.Root;
|
|
56
56
|
|
|
57
|
-
declare const PROTOCOL_V2_SYS_MESSAGE_THRESHOLD = 60000;
|
|
58
|
-
type ProtocolV2Schemas$1 = {
|
|
59
|
-
protocolV1: Root;
|
|
60
|
-
protocolV2: Root;
|
|
61
|
-
};
|
|
62
|
-
type ProtocolV2FrameOptions = {
|
|
63
|
-
packetSrc?: number;
|
|
64
|
-
router?: number;
|
|
65
|
-
};
|
|
66
|
-
declare const ProtocolV1: {
|
|
67
|
-
encodeEnvelope: typeof encodeEnvelopeMessage;
|
|
68
|
-
encodeMessageChunks: (messages: Root, name: string, data: Record<string, unknown>) => Buffer[];
|
|
69
|
-
encodeTransportPackets: (messages: Root, name: string, data: Record<string, unknown>) => ByteBuffer__default[];
|
|
70
|
-
decodeFirstChunk: (bytes: ArrayBuffer) => {
|
|
71
|
-
length: number;
|
|
72
|
-
typeId: number;
|
|
73
|
-
restBuffer: ByteBuffer__default;
|
|
74
|
-
};
|
|
75
|
-
decodeMessage: typeof decodeMessage;
|
|
76
|
-
};
|
|
77
|
-
declare const ProtocolV2: {
|
|
78
|
-
encodeFrame(schemas: ProtocolV2Schemas$1, name: string, data: Record<string, unknown>, options?: ProtocolV2FrameOptions): Uint8Array;
|
|
79
|
-
decodeFrame(schemas: ProtocolV2Schemas$1, frame: Uint8Array): {
|
|
80
|
-
message: {
|
|
81
|
-
[key: string]: any;
|
|
82
|
-
};
|
|
83
|
-
messageName: string;
|
|
84
|
-
messageTypeId: number;
|
|
85
|
-
pbPayload: Uint8Array;
|
|
86
|
-
seq: number;
|
|
87
|
-
type: string;
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
|
|
91
57
|
declare const PROTO_HEAD_SOF = 90;
|
|
92
58
|
declare const PROTO_PRE_HEAD_SIZE = 4;
|
|
93
59
|
declare const PROTO_HEAD_CRC_SIZE = 8;
|
|
@@ -98,15 +64,28 @@ declare const PROTO_DATA_TYPE_PACKET = 0;
|
|
|
98
64
|
declare const CRC8_TABLE: Uint8Array;
|
|
99
65
|
declare function crc8(data: Uint8Array, len: number): number;
|
|
100
66
|
|
|
101
|
-
|
|
102
|
-
|
|
67
|
+
type ProtocolV2DebugLogger = {
|
|
68
|
+
debug?: (...args: unknown[]) => void;
|
|
69
|
+
};
|
|
70
|
+
type ProtocolV2FrameDebugOptions = {
|
|
71
|
+
logger?: ProtocolV2DebugLogger;
|
|
72
|
+
logPrefix?: string;
|
|
73
|
+
context?: string;
|
|
74
|
+
messageName?: string;
|
|
75
|
+
messageTypeId?: number;
|
|
76
|
+
pbPayloadLength?: number;
|
|
77
|
+
};
|
|
78
|
+
declare function logProtocolV2Debug(options: ProtocolV2FrameDebugOptions | undefined, stage: string, details: Record<string, unknown>): void;
|
|
79
|
+
|
|
80
|
+
declare function encodeFrame(payload: Uint8Array | null, packetSrc?: number, router?: number, debugOptions?: ProtocolV2FrameDebugOptions): Uint8Array;
|
|
81
|
+
declare function encodeProtobufFrame(messageTypeId: number, pbPayload: Uint8Array, packetSrc?: number, router?: number, debugOptions?: ProtocolV2FrameDebugOptions): Uint8Array;
|
|
103
82
|
|
|
104
83
|
interface ProtoV2Frame {
|
|
105
84
|
messageTypeId: number;
|
|
106
85
|
pbPayload: Uint8Array;
|
|
107
86
|
seq: number;
|
|
108
87
|
}
|
|
109
|
-
declare function decodeFrame(data: Uint8Array): ProtoV2Frame;
|
|
88
|
+
declare function decodeFrame(data: Uint8Array, debugOptions?: ProtocolV2FrameDebugOptions): ProtoV2Frame;
|
|
110
89
|
|
|
111
90
|
declare function concatUint8Arrays(arrays: Uint8Array[]): Uint8Array;
|
|
112
91
|
declare class ProtocolV2FrameAssembler {
|
|
@@ -125,6 +104,9 @@ declare const protocolV2Codec_PACKET_SIZE: typeof PACKET_SIZE;
|
|
|
125
104
|
declare const protocolV2Codec_PROTO_DATA_TYPE_PACKET: typeof PROTO_DATA_TYPE_PACKET;
|
|
126
105
|
declare const protocolV2Codec_CRC8_TABLE: typeof CRC8_TABLE;
|
|
127
106
|
declare const protocolV2Codec_crc8: typeof crc8;
|
|
107
|
+
type protocolV2Codec_ProtocolV2DebugLogger = ProtocolV2DebugLogger;
|
|
108
|
+
type protocolV2Codec_ProtocolV2FrameDebugOptions = ProtocolV2FrameDebugOptions;
|
|
109
|
+
declare const protocolV2Codec_logProtocolV2Debug: typeof logProtocolV2Debug;
|
|
128
110
|
declare const protocolV2Codec_encodeFrame: typeof encodeFrame;
|
|
129
111
|
declare const protocolV2Codec_encodeProtobufFrame: typeof encodeProtobufFrame;
|
|
130
112
|
type protocolV2Codec_ProtoV2Frame = ProtoV2Frame;
|
|
@@ -142,6 +124,9 @@ declare namespace protocolV2Codec {
|
|
|
142
124
|
protocolV2Codec_PROTO_DATA_TYPE_PACKET as PROTO_DATA_TYPE_PACKET,
|
|
143
125
|
protocolV2Codec_CRC8_TABLE as CRC8_TABLE,
|
|
144
126
|
protocolV2Codec_crc8 as crc8,
|
|
127
|
+
protocolV2Codec_ProtocolV2DebugLogger as ProtocolV2DebugLogger,
|
|
128
|
+
protocolV2Codec_ProtocolV2FrameDebugOptions as ProtocolV2FrameDebugOptions,
|
|
129
|
+
protocolV2Codec_logProtocolV2Debug as logProtocolV2Debug,
|
|
145
130
|
protocolV2Codec_encodeFrame as encodeFrame,
|
|
146
131
|
protocolV2Codec_encodeProtobufFrame as encodeProtobufFrame,
|
|
147
132
|
protocolV2Codec_ProtoV2Frame as ProtoV2Frame,
|
|
@@ -151,6 +136,43 @@ declare namespace protocolV2Codec {
|
|
|
151
136
|
};
|
|
152
137
|
}
|
|
153
138
|
|
|
139
|
+
declare const PROTOCOL_V2_SYS_MESSAGE_THRESHOLD = 60000;
|
|
140
|
+
type ProtocolV2Schemas$1 = {
|
|
141
|
+
protocolV1: Root;
|
|
142
|
+
protocolV2: Root;
|
|
143
|
+
};
|
|
144
|
+
type ProtocolV2FrameOptions = {
|
|
145
|
+
packetSrc?: number;
|
|
146
|
+
router?: number;
|
|
147
|
+
logger?: ProtocolV2DebugLogger;
|
|
148
|
+
logPrefix?: string;
|
|
149
|
+
context?: string;
|
|
150
|
+
};
|
|
151
|
+
declare const ProtocolV1: {
|
|
152
|
+
encodeEnvelope: typeof encodeEnvelopeMessage;
|
|
153
|
+
encodeMessageChunks: (messages: Root, name: string, data: Record<string, unknown>) => Buffer[];
|
|
154
|
+
encodeTransportPackets: (messages: Root, name: string, data: Record<string, unknown>) => ByteBuffer__default[];
|
|
155
|
+
decodeFirstChunk: (bytes: ArrayBuffer) => {
|
|
156
|
+
length: number;
|
|
157
|
+
typeId: number;
|
|
158
|
+
restBuffer: ByteBuffer__default;
|
|
159
|
+
};
|
|
160
|
+
decodeMessage: typeof decodeMessage;
|
|
161
|
+
};
|
|
162
|
+
declare const ProtocolV2: {
|
|
163
|
+
encodeFrame(schemas: ProtocolV2Schemas$1, name: string, data: Record<string, unknown>, options?: ProtocolV2FrameOptions): Uint8Array;
|
|
164
|
+
decodeFrame(schemas: ProtocolV2Schemas$1, frame: Uint8Array, options?: Pick<ProtocolV2FrameOptions, 'logger' | 'logPrefix' | 'context'>): {
|
|
165
|
+
message: {
|
|
166
|
+
[key: string]: any;
|
|
167
|
+
};
|
|
168
|
+
messageName: string;
|
|
169
|
+
messageTypeId: number;
|
|
170
|
+
pbPayload: Uint8Array;
|
|
171
|
+
seq: number;
|
|
172
|
+
type: string;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
|
|
154
176
|
type ProtocolType = 'V1' | 'V2';
|
|
155
177
|
type OneKeyDeviceCommType = 'usb' | 'webusb' | 'ble' | 'webble' | 'electron-ble' | 'bridge' | 'emulator';
|
|
156
178
|
type OneKeyUsbDeviceInfo = {
|
|
@@ -201,7 +223,7 @@ type Transport = {
|
|
|
201
223
|
read(session: string): Promise<MessageFromOneKey>;
|
|
202
224
|
cancel(): Promise<void>;
|
|
203
225
|
disconnect?: (session: string) => Promise<void>;
|
|
204
|
-
getProtocolType: (path: string) => ProtocolType;
|
|
226
|
+
getProtocolType: (path: string) => ProtocolType | undefined;
|
|
205
227
|
promptDeviceAccess?: () => Promise<USBDevice | BluetoothDevice | null>;
|
|
206
228
|
init: ITransportInitFn;
|
|
207
229
|
stop(): void;
|
|
@@ -3794,10 +3816,22 @@ type FilesystemFormat = {};
|
|
|
3794
3816
|
type FilesystemDiskControl = {
|
|
3795
3817
|
enable: number;
|
|
3796
3818
|
};
|
|
3819
|
+
declare enum OnboardingStep {
|
|
3820
|
+
UNKNOWN = 0,
|
|
3821
|
+
SECURITY_CHECK = 1,
|
|
3822
|
+
PIN = 2,
|
|
3823
|
+
SETUP_CHOICE = 3,
|
|
3824
|
+
CREATE_NEW = 4,
|
|
3825
|
+
SEEDCARD_BACKUP = 5,
|
|
3826
|
+
RESTORE_CHOICE = 6,
|
|
3827
|
+
RESTORE_MNEMONIC = 7,
|
|
3828
|
+
RESTORE_MNEMONIC_SEEDCARD_BACKUP = 8,
|
|
3829
|
+
RESTORE_SEEDCARD = 9,
|
|
3830
|
+
DONE = 100
|
|
3831
|
+
}
|
|
3797
3832
|
type DeviceGetOnboardingStatus = {};
|
|
3798
3833
|
type DeviceOnboardingStatus = {
|
|
3799
|
-
|
|
3800
|
-
page_count?: number;
|
|
3834
|
+
step: OnboardingStep;
|
|
3801
3835
|
page_name?: string;
|
|
3802
3836
|
};
|
|
3803
3837
|
type MessageType = {
|
|
@@ -5185,6 +5219,8 @@ type messages_FilesystemDirMake = FilesystemDirMake;
|
|
|
5185
5219
|
type messages_FilesystemDirRemove = FilesystemDirRemove;
|
|
5186
5220
|
type messages_FilesystemFormat = FilesystemFormat;
|
|
5187
5221
|
type messages_FilesystemDiskControl = FilesystemDiskControl;
|
|
5222
|
+
type messages_OnboardingStep = OnboardingStep;
|
|
5223
|
+
declare const messages_OnboardingStep: typeof OnboardingStep;
|
|
5188
5224
|
type messages_DeviceGetOnboardingStatus = DeviceGetOnboardingStatus;
|
|
5189
5225
|
type messages_DeviceOnboardingStatus = DeviceOnboardingStatus;
|
|
5190
5226
|
type messages_MessageType = MessageType;
|
|
@@ -5885,6 +5921,7 @@ declare namespace messages {
|
|
|
5885
5921
|
messages_FilesystemDirRemove as FilesystemDirRemove,
|
|
5886
5922
|
messages_FilesystemFormat as FilesystemFormat,
|
|
5887
5923
|
messages_FilesystemDiskControl as FilesystemDiskControl,
|
|
5924
|
+
messages_OnboardingStep as OnboardingStep,
|
|
5888
5925
|
messages_DeviceGetOnboardingStatus as DeviceGetOnboardingStatus,
|
|
5889
5926
|
messages_DeviceOnboardingStatus as DeviceOnboardingStatus,
|
|
5890
5927
|
messages_MessageType as MessageType,
|
|
@@ -6001,11 +6038,20 @@ declare const _default: {
|
|
|
6001
6038
|
}, name: string, data: Record<string, unknown>, options?: {
|
|
6002
6039
|
packetSrc?: number | undefined;
|
|
6003
6040
|
router?: number | undefined;
|
|
6041
|
+
logger?: ProtocolV2DebugLogger | undefined;
|
|
6042
|
+
logPrefix?: string | undefined;
|
|
6043
|
+
context?: string | undefined;
|
|
6004
6044
|
}): Uint8Array;
|
|
6005
6045
|
decodeFrame(schemas: {
|
|
6006
6046
|
protocolV1: protobuf.Root;
|
|
6007
6047
|
protocolV2: protobuf.Root;
|
|
6008
|
-
}, frame: Uint8Array
|
|
6048
|
+
}, frame: Uint8Array, options?: Pick<{
|
|
6049
|
+
packetSrc?: number | undefined;
|
|
6050
|
+
router?: number | undefined;
|
|
6051
|
+
logger?: ProtocolV2DebugLogger | undefined;
|
|
6052
|
+
logPrefix?: string | undefined;
|
|
6053
|
+
context?: string | undefined;
|
|
6054
|
+
}, "logger" | "logPrefix" | "context">): {
|
|
6009
6055
|
message: {
|
|
6010
6056
|
[key: string]: any;
|
|
6011
6057
|
};
|
|
@@ -6039,4 +6085,4 @@ declare const _default: {
|
|
|
6039
6085
|
withProtocolTimeout: typeof withProtocolTimeout;
|
|
6040
6086
|
};
|
|
6041
6087
|
|
|
6042
|
-
export { AcquireInput, Address, AlephiumAddress, AlephiumBytecodeAck, AlephiumBytecodeRequest, AlephiumGetAddress, AlephiumMessageSignature, AlephiumSignMessage, AlephiumSignTx, AlephiumSignedTx, AlephiumTxAck, AlephiumTxRequest, AlgorandAddress, AlgorandGetAddress, AlgorandSignTx, AlgorandSignedTx, AmountUnit, ApplyFlags, ApplySettings, AptosAddress, AptosGetAddress, AptosMessagePayload, AptosMessageSignature, AptosSignMessage, AptosSignSIWAMessage, AptosSignTx, AptosSignedTx, AptosTransactionType, AuthorizeCoinJoin, BIP32Address, BackupDevice, BackupType, BatchGetPublickeys, BenfenAddress, BenfenGetAddress, BenfenMessageSignature, BenfenSignMessage, BenfenSignTx, BenfenSignedTx, BenfenTxAck, BenfenTxRequest, BinanceAddress, BinanceCancelMsg, BinanceCoin, BinanceGetAddress, BinanceGetPublicKey, BinanceInputOutput, BinanceOrderMsg, BinanceOrderSide, BinanceOrderType, BinancePublicKey, BinanceSignTx, BinanceSignedTx, BinanceTimeInForce, BinanceTransferMsg, BinanceTxRequest, BixinBackupAck, BixinBackupDevice, BixinBackupDeviceAck, BixinBackupRequest, BixinLoadDevice, BixinMessageSE, BixinOutMessageSE, BixinPinInputOnDevice, BixinRestoreAck, BixinRestoreRequest, BixinSeedOperate, BixinVerifyDeviceAck, BixinVerifyDeviceRequest, BixinWhiteListAck, BixinWhiteListRequest, BlurRequest, ButtonAck, ButtonRequest, ButtonRequestType, Cancel, CancelAuthorization, Capability, CardanoAddress, CardanoAddressParametersType, CardanoAddressType, CardanoAssetGroup, CardanoBlockchainPointerType, CardanoCVoteRegistrationDelegation, CardanoCVoteRegistrationFormat, CardanoCVoteRegistrationParametersType, CardanoCertificateType, CardanoDRep, CardanoDRepType, CardanoDerivationType, CardanoGetAddress, CardanoGetNativeScriptHash, CardanoGetPublicKey, CardanoMessageSignature, CardanoNativeScript, CardanoNativeScriptHash, CardanoNativeScriptHashDisplayFormat, CardanoNativeScriptType, CardanoPoolMetadataType, CardanoPoolOwner, CardanoPoolParametersType, CardanoPoolRelayParameters, CardanoPoolRelayType, CardanoPublicKey, CardanoSignMessage, CardanoSignTxFinished, CardanoSignTxInit, CardanoToken, CardanoTxAuxiliaryData, CardanoTxAuxiliaryDataSupplement, CardanoTxAuxiliaryDataSupplementType, CardanoTxBodyHash, CardanoTxCertificate, CardanoTxCollateralInput, CardanoTxHostAck, CardanoTxInlineDatumChunk, CardanoTxInput, CardanoTxItemAck, CardanoTxMint, CardanoTxOutput, CardanoTxOutputSerializationFormat, CardanoTxReferenceInput, CardanoTxReferenceScriptChunk, CardanoTxRequiredSigner, CardanoTxSigningMode, CardanoTxWithdrawal, CardanoTxWitnessRequest, CardanoTxWitnessResponse, CardanoTxWitnessType, ChangeOutputScriptType, ChangePin, ChangeWipeCode, CipherKeyValue, CipheredKeyValue, CoinPurchaseMemo, CommandFlags, ConfluxAddress, ConfluxGetAddress, ConfluxMessageSignature, ConfluxSignMessage, ConfluxSignMessageCIP23, ConfluxSignTx, ConfluxTxAck, ConfluxTxRequest, CosmosAddress, CosmosGetAddress, CosmosSignTx, CosmosSignedTx, DecredStakingSpendType, Deprecated_PassphraseStateAck, Deprecated_PassphraseStateRequest, DeviceBackToBoot, DeviceBluetoothInfo, DeviceEraseSector, DeviceFirmwareImageInfo, DeviceFirmwareInstallProgress, DeviceFirmwareTarget, DeviceFirmwareTargetType, DeviceFirmwareUpdate, DeviceFirmwareUpdateStatus, DeviceFirmwareUpdateStatusEntry, DeviceGetDeviceInfo, DeviceGetFirmwareUpdateStatus, DeviceGetOnboardingStatus, DeviceHardwareInfo, DeviceInfo, DeviceInfoSettings, DeviceInfoTargets, DeviceInfoTypes, DeviceMainMcuInfo, DeviceOnboardingStatus, DeviceReboot, DeviceRebootType, DeviceSEInfo, DeviceSEState, DeviceSeType, DeviceStatus, DeviceType, DnxAddress, DnxComputedKeyImage, DnxGetAddress, DnxInputAck, DnxInputRequest, DnxRTSigsRequest, DnxSignTx, DnxSignedTx, DnxTxKey, DoPreauthorized, ECDHSessionKey, EcdsaPublicKeys, EmmcDir, EmmcDirList, EmmcDirMake, EmmcDirRemove, EmmcFile, EmmcFileDelete, EmmcFileRead, EmmcFileWrite, EmmcFixPermission, EmmcPath, EmmcPathInfo, EndSession, Entropy, EntropyAck, EntropyRequest, Enum_BackupType, Enum_ButtonRequestType, Enum_Capability, Enum_InputScriptType, Enum_OutputScriptType, Enum_PinMatrixRequestType, Enum_RequestType, Enum_SafetyCheckLevel, Enum_WordRequestType, EosActionBuyRam, EosActionBuyRamBytes, EosActionCommon, EosActionDelegate, EosActionDeleteAuth, EosActionLinkAuth, EosActionNewAccount, EosActionRefund, EosActionSellRam, EosActionTransfer, EosActionUndelegate, EosActionUnknown, EosActionUnlinkAuth, EosActionUpdateAuth, EosActionVoteProducer, EosAsset, EosAuthorization, EosAuthorizationAccount, EosAuthorizationKey, EosAuthorizationWait, EosGetPublicKey, EosPermissionLevel, EosPublicKey, EosSignTx, EosSignedTx, EosTxActionAck, EosTxActionRequest, EosTxHeader, EthereumAccessList, EthereumAccessListOneKey, EthereumAddress, EthereumAddressOneKey, EthereumAuthorizationOneKey, EthereumAuthorizationSignature, EthereumDataType, EthereumDataTypeOneKey, EthereumDefinitionType, EthereumDefinitions, EthereumFieldType, EthereumFieldTypeOneKey, EthereumGetAddress, EthereumGetAddressOneKey, EthereumGetPublicKey, EthereumGetPublicKeyOneKey, EthereumGnosisSafeTxAck, EthereumGnosisSafeTxOperation, EthereumGnosisSafeTxRequest, EthereumMessageSignature, EthereumMessageSignatureOneKey, EthereumNetworkInfo, EthereumPublicKey, EthereumPublicKeyOneKey, EthereumSignMessage, EthereumSignMessageEIP712, EthereumSignMessageOneKey, EthereumSignTx, EthereumSignTxEIP1559, EthereumSignTxEIP1559OneKey, EthereumSignTxEIP7702OneKey, EthereumSignTxOneKey, EthereumSignTypedData, EthereumSignTypedDataOneKey, EthereumSignTypedHash, EthereumSignTypedHashOneKey, EthereumStructMember, EthereumStructMemberOneKey, EthereumTokenInfo, EthereumTxAck, EthereumTxAckOneKey, EthereumTxRequest, EthereumTxRequestOneKey, EthereumTypedDataSignature, EthereumTypedDataSignatureOneKey, EthereumTypedDataStructAck, EthereumTypedDataStructAckOneKey, EthereumTypedDataStructRequest, EthereumTypedDataStructRequestOneKey, EthereumTypedDataValueAck, EthereumTypedDataValueAckOneKey, EthereumTypedDataValueRequest, EthereumTypedDataValueRequestOneKey, EthereumVerifyMessage, EthereumVerifyMessageOneKey, ExportType, FactoryDeviceInfo, FactoryDeviceInfoSettings, FactoryGetDeviceInfo, Failure, FailureType, Features, FileInfo, FileInfoList, FilecoinAddress, FilecoinGetAddress, FilecoinSignTx, FilecoinSignedTx, FilesystemDir, FilesystemDirList, FilesystemDirMake, FilesystemDirRemove, FilesystemDiskControl, FilesystemFile, FilesystemFileDelete, FilesystemFileRead, FilesystemFileWrite, FilesystemFixPermission, FilesystemFormat, FilesystemPathInfo, FilesystemPathInfoQuery, FirmwareErase, FirmwareErase_ex, FirmwareHash, FirmwareRequest, FirmwareUpdateEmmc, FirmwareUpload, GetAddress, GetDeviceInfo, GetECDHSessionKey, GetEntropy, GetFeatures, GetFirmwareHash, GetNextU2FCounter, GetNonce, GetOwnershipId, GetOwnershipProof, GetPassphraseState, GetProtoVersion, GetPublicKey, GetPublicKeyMultiple, HDNodePathType, HDNodeType, IdentityType, Initialize, InputScriptType, InternalInputScriptType, KaspaAddress, KaspaGetAddress, KaspaSignTx, KaspaSignedTx, KaspaTxInputAck, KaspaTxInputRequest, ListResDir, LnurlAuth, LnurlAuthResp, LockDevice, LogBlockCommand, LowLevelDevice, LowlevelTransportSharedPlugin, MessageFromOneKey, MessageKey, MessageResponse, MessageResponseMap, MessageSignature, MessageType, messages as Messages, MoneroAccountPublicAddress, MoneroAddress, MoneroExportedKeyImage, MoneroGetAddress, MoneroGetTxKeyAck, MoneroGetTxKeyRequest, MoneroGetWatchKey, MoneroKeyImageExportInitAck, MoneroKeyImageExportInitRequest, MoneroKeyImageSyncFinalAck, MoneroKeyImageSyncFinalRequest, MoneroKeyImageSyncStepAck, MoneroKeyImageSyncStepRequest, MoneroLiveRefreshFinalAck, MoneroLiveRefreshFinalRequest, MoneroLiveRefreshStartAck, MoneroLiveRefreshStartRequest, MoneroLiveRefreshStepAck, MoneroLiveRefreshStepRequest, MoneroMultisigKLRki, MoneroNetworkType, MoneroOutputEntry, MoneroRctKeyPublic, MoneroRingCtSig, MoneroSubAddressIndicesList, MoneroTransactionAllInputsSetAck, MoneroTransactionAllInputsSetRequest, MoneroTransactionAllOutSetAck, MoneroTransactionAllOutSetRequest, MoneroTransactionData, MoneroTransactionDestinationEntry, MoneroTransactionFinalAck, MoneroTransactionFinalRequest, MoneroTransactionInitAck, MoneroTransactionInitRequest, MoneroTransactionInputViniAck, MoneroTransactionInputViniRequest, MoneroTransactionInputsPermutationAck, MoneroTransactionInputsPermutationRequest, MoneroTransactionRsigData, MoneroTransactionSetInputAck, MoneroTransactionSetInputRequest, MoneroTransactionSetOutputAck, MoneroTransactionSetOutputRequest, MoneroTransactionSignInputAck, MoneroTransactionSignInputRequest, MoneroTransactionSourceEntry, MoneroTransferDetails, MoneroWatchKey, MultisigRedeemScriptType, NEMAddress, NEMAggregateModification, NEMCosignatoryModification, NEMDecryptMessage, NEMDecryptedMessage, NEMGetAddress, NEMImportanceTransfer, NEMImportanceTransferMode, NEMModificationType, NEMMosaic, NEMMosaicCreation, NEMMosaicDefinition, NEMMosaicLevy, NEMMosaicSupplyChange, NEMProvisionNamespace, NEMSignTx, NEMSignedTx, NEMSupplyChangeType, NEMTransactionCommon, NEMTransfer, NFTWriteData, NFTWriteInfo, NearAddress, NearGetAddress, NearSignTx, NearSignedTx, NeoAddress, NeoGetAddress, NeoSignTx, NeoSignedTx, NervosAddress, NervosGetAddress, NervosSignTx, NervosSignedTx, NervosTxAck, NervosTxRequest, NexaAddress, NexaGetAddress, NexaSignTx, NexaSignedTx, NexaTxInputAck, NexaTxInputRequest, NextU2FCounter, Nonce, NostrDecryptMessage, NostrDecryptedMessage, NostrEncryptMessage, NostrEncryptedMessage, NostrGetPublicKey, NostrPublicKey, NostrSignEvent, NostrSignSchnorr, NostrSignedEvent, NostrSignedSchnorr, OneKeyDeviceCommType, OneKeyDeviceInfo, OneKeyDeviceInfoBase, OneKeyDeviceInfoWithSession, OneKeyDeviceType, OneKeyMobileDeviceInfo, OneKeySEState, OneKeySeType, OnekeyFeatures, OnekeyGetFeatures, OutputScriptType, OwnershipId, OwnershipProof, PROTOCOL_V1_CHUNK_PAYLOAD_SIZE, PROTOCOL_V1_ENVELOPE_HEADER_SIZE, PROTOCOL_V1_HEADER_BYTE, PROTOCOL_V1_MESSAGE_HEADER_SIZE, PROTOCOL_V1_REPORT_ID, PROTOCOL_V1_USB_PACKET_SIZE, PROTOCOL_V2_BLE_FILE_CHUNK_SIZE, PROTOCOL_V2_CHANNEL_BLE_UART, PROTOCOL_V2_CHANNEL_SOCKET, PROTOCOL_V2_CHANNEL_USB, PROTOCOL_V2_FILE_CHUNK_SIZE, PROTOCOL_V2_FRAME_MAX_BYTES, PROTOCOL_V2_PACKET_SRC_COMMAND, PROTOCOL_V2_SYS_MESSAGE_THRESHOLD, PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE, PassphraseAck, PassphraseRequest, PassphraseState, Path, PaymentRequestMemo, PinMatrixAck, PinMatrixRequest, PinMatrixRequestType, Ping, PolkadotAddress, PolkadotGetAddress, PolkadotSignTx, PolkadotSignedTx, PreauthorizedRequest, PrevInput, PrevOutput, PrevTx, ProtoVersion, ProtocolType, ProtocolV1, ProtocolV2, ProtocolV2CallOptions, ProtocolV2DeviceInfo, ProtocolV2FrameAssembler, ProtocolV2Schemas, ProtocolV2Session, ProtocolV2SessionOptions, PublicKey, PublicKeyMultiple, ReadSEPublicCert, ReadSEPublicKey, Reboot, RebootToBoardloader, RebootToBootloader, RebootType, RecoveryDevice, RecoveryDeviceType, RefundMemo, RequestType, ResetDevice, ResourceAck, ResourceRequest, ResourceType, ResourceUpdate, ResourceUpload, RippleAddress, RippleGetAddress, RipplePayment, RippleSignTx, RippleSignedTx, SEMessageSignature, SEPublicCert, SEPublicKey, SESignMessage, SafetyCheckLevel, ScdoAddress, ScdoGetAddress, ScdoSignMessage, ScdoSignTx, ScdoSignedMessage, ScdoSignedTx, ScdoTxAck, SdProtect, SdProtectOperationType, SeedRequestType, SelfTest, SetBusy, SetU2FCounter, SignIdentity, SignMessage, SignPsbt, SignTx, SignedIdentity, SignedPsbt, SolanaAddress, SolanaGetAddress, SolanaMessageSignature, SolanaOffChainMessageFormat, SolanaOffChainMessageVersion, SolanaSignOffChainMessage, SolanaSignTx, SolanaSignUnsafeMessage, SolanaSignedTx, SolanaTxATADetails, SolanaTxExtraInfo, SpiFlashData, SpiFlashRead, SpiFlashWrite, StarcoinAddress, StarcoinGetAddress, StarcoinGetPublicKey, StarcoinMessageSignature, StarcoinPublicKey, StarcoinSignMessage, StarcoinSignTx, StarcoinSignedTx, StarcoinVerifyMessage, StellarAccountMergeOp, StellarAddress, StellarAllowTrustOp, StellarAsset, StellarAssetType, StellarBumpSequenceOp, StellarChangeTrustOp, StellarCreateAccountOp, StellarCreatePassiveSellOfferOp, StellarGetAddress, StellarInvokeHostFunctionOp, StellarManageBuyOfferOp, StellarManageDataOp, StellarManageSellOfferOp, StellarMemoType, StellarPathPaymentStrictReceiveOp, StellarPathPaymentStrictSendOp, StellarPaymentOp, StellarRequestType, StellarSetOptionsOp, StellarSignTx, StellarSignedTx, StellarSignerType, StellarSorobanDataAck, StellarSorobanDataRequest, StellarTxOpRequest, Success, SuiAddress, SuiGetAddress, SuiMessageSignature, SuiSignMessage, SuiSignTx, SuiSignedTx, SuiTxAck, SuiTxRequest, TextMemo, TezosAddress, TezosBallotOp, TezosBallotType, TezosContractID, TezosContractType, TezosDelegationOp, TezosGetAddress, TezosGetPublicKey, TezosManagerTransfer, TezosOriginationOp, TezosParametersManager, TezosProposalOp, TezosPublicKey, TezosRevealOp, TezosSignTx, TezosSignedTx, TezosTransactionOp, TonAddress, TonGetAddress, TonSignData, TonSignDataType, TonSignMessage, TonSignProof, TonSignedData, TonSignedMessage, TonSignedProof, TonTxAck, TonWalletVersion, TonWorkChain, Transport, TransportCallOptions, TronAddress, TronCancelAllUnfreezeV2Contract, TronContract, TronDelegateResourceContract, TronFreezeBalanceContract, TronFreezeBalanceV2Contract, TronGetAddress, TronMessageSignature, TronMessageType, TronResourceCode, TronSignMessage, TronSignTx, TronSignedTx, TronTransferContract, TronTriggerSmartContract, TronUnDelegateResourceContract, TronUnfreezeBalanceContract, TronUnfreezeBalanceV2Contract, TronVoteWitnessContract, TronWithdrawBalanceContract, TronWithdrawExpireUnfreezeContract, TxAck, TxAckInput, TxAckInputWrapper, TxAckOutput, TxAckOutputWrapper, TxAckPaymentRequest, TxAckPrevExtraData, TxAckPrevExtraDataWrapper, TxAckPrevInput, TxAckPrevInputWrapper, TxAckPrevMeta, TxAckPrevOutput, TxAckPrevOutputWrapper, TxAckResponse, TxDetailsAddress, TxDetailsAmount, TxDetailsDisplayType, TxDetailsGeneral, TxDetailsNetwork, TxDetailsPage, TxInput, TxInputType, TxOutput, TxOutputBinType, TxOutputType, TxRequest, TxRequestDetailsType, TxRequestSerializedType, TypedCall, UintType, UnLockDevice, UnLockDeviceResponse, UnlockPath, UnlockedPathRequest, UpgradeFileHeader, VerifyMessage, Vote, WL_OperationType, WipeDevice, WordAck, WordRequest, WordRequestType, WriteSEPrivateKey, WriteSEPublicCert, ZoomRequest, bytesToHex, concatUint8Arrays, _default as default, experimental_field, experimental_message, facotry, getErrorMessage, hexToBytes, probeProtocolV2, index as protocolV1, protocolV2Codec as protocolV2, withProtocolTimeout };
|
|
6088
|
+
export { AcquireInput, Address, AlephiumAddress, AlephiumBytecodeAck, AlephiumBytecodeRequest, AlephiumGetAddress, AlephiumMessageSignature, AlephiumSignMessage, AlephiumSignTx, AlephiumSignedTx, AlephiumTxAck, AlephiumTxRequest, AlgorandAddress, AlgorandGetAddress, AlgorandSignTx, AlgorandSignedTx, AmountUnit, ApplyFlags, ApplySettings, AptosAddress, AptosGetAddress, AptosMessagePayload, AptosMessageSignature, AptosSignMessage, AptosSignSIWAMessage, AptosSignTx, AptosSignedTx, AptosTransactionType, AuthorizeCoinJoin, BIP32Address, BackupDevice, BackupType, BatchGetPublickeys, BenfenAddress, BenfenGetAddress, BenfenMessageSignature, BenfenSignMessage, BenfenSignTx, BenfenSignedTx, BenfenTxAck, BenfenTxRequest, BinanceAddress, BinanceCancelMsg, BinanceCoin, BinanceGetAddress, BinanceGetPublicKey, BinanceInputOutput, BinanceOrderMsg, BinanceOrderSide, BinanceOrderType, BinancePublicKey, BinanceSignTx, BinanceSignedTx, BinanceTimeInForce, BinanceTransferMsg, BinanceTxRequest, BixinBackupAck, BixinBackupDevice, BixinBackupDeviceAck, BixinBackupRequest, BixinLoadDevice, BixinMessageSE, BixinOutMessageSE, BixinPinInputOnDevice, BixinRestoreAck, BixinRestoreRequest, BixinSeedOperate, BixinVerifyDeviceAck, BixinVerifyDeviceRequest, BixinWhiteListAck, BixinWhiteListRequest, BlurRequest, ButtonAck, ButtonRequest, ButtonRequestType, Cancel, CancelAuthorization, Capability, CardanoAddress, CardanoAddressParametersType, CardanoAddressType, CardanoAssetGroup, CardanoBlockchainPointerType, CardanoCVoteRegistrationDelegation, CardanoCVoteRegistrationFormat, CardanoCVoteRegistrationParametersType, CardanoCertificateType, CardanoDRep, CardanoDRepType, CardanoDerivationType, CardanoGetAddress, CardanoGetNativeScriptHash, CardanoGetPublicKey, CardanoMessageSignature, CardanoNativeScript, CardanoNativeScriptHash, CardanoNativeScriptHashDisplayFormat, CardanoNativeScriptType, CardanoPoolMetadataType, CardanoPoolOwner, CardanoPoolParametersType, CardanoPoolRelayParameters, CardanoPoolRelayType, CardanoPublicKey, CardanoSignMessage, CardanoSignTxFinished, CardanoSignTxInit, CardanoToken, CardanoTxAuxiliaryData, CardanoTxAuxiliaryDataSupplement, CardanoTxAuxiliaryDataSupplementType, CardanoTxBodyHash, CardanoTxCertificate, CardanoTxCollateralInput, CardanoTxHostAck, CardanoTxInlineDatumChunk, CardanoTxInput, CardanoTxItemAck, CardanoTxMint, CardanoTxOutput, CardanoTxOutputSerializationFormat, CardanoTxReferenceInput, CardanoTxReferenceScriptChunk, CardanoTxRequiredSigner, CardanoTxSigningMode, CardanoTxWithdrawal, CardanoTxWitnessRequest, CardanoTxWitnessResponse, CardanoTxWitnessType, ChangeOutputScriptType, ChangePin, ChangeWipeCode, CipherKeyValue, CipheredKeyValue, CoinPurchaseMemo, CommandFlags, ConfluxAddress, ConfluxGetAddress, ConfluxMessageSignature, ConfluxSignMessage, ConfluxSignMessageCIP23, ConfluxSignTx, ConfluxTxAck, ConfluxTxRequest, CosmosAddress, CosmosGetAddress, CosmosSignTx, CosmosSignedTx, DecredStakingSpendType, Deprecated_PassphraseStateAck, Deprecated_PassphraseStateRequest, DeviceBackToBoot, DeviceBluetoothInfo, DeviceEraseSector, DeviceFirmwareImageInfo, DeviceFirmwareInstallProgress, DeviceFirmwareTarget, DeviceFirmwareTargetType, DeviceFirmwareUpdate, DeviceFirmwareUpdateStatus, DeviceFirmwareUpdateStatusEntry, DeviceGetDeviceInfo, DeviceGetFirmwareUpdateStatus, DeviceGetOnboardingStatus, DeviceHardwareInfo, DeviceInfo, DeviceInfoSettings, DeviceInfoTargets, DeviceInfoTypes, DeviceMainMcuInfo, DeviceOnboardingStatus, DeviceReboot, DeviceRebootType, DeviceSEInfo, DeviceSEState, DeviceSeType, DeviceStatus, DeviceType, DnxAddress, DnxComputedKeyImage, DnxGetAddress, DnxInputAck, DnxInputRequest, DnxRTSigsRequest, DnxSignTx, DnxSignedTx, DnxTxKey, DoPreauthorized, ECDHSessionKey, EcdsaPublicKeys, EmmcDir, EmmcDirList, EmmcDirMake, EmmcDirRemove, EmmcFile, EmmcFileDelete, EmmcFileRead, EmmcFileWrite, EmmcFixPermission, EmmcPath, EmmcPathInfo, EndSession, Entropy, EntropyAck, EntropyRequest, Enum_BackupType, Enum_ButtonRequestType, Enum_Capability, Enum_InputScriptType, Enum_OutputScriptType, Enum_PinMatrixRequestType, Enum_RequestType, Enum_SafetyCheckLevel, Enum_WordRequestType, EosActionBuyRam, EosActionBuyRamBytes, EosActionCommon, EosActionDelegate, EosActionDeleteAuth, EosActionLinkAuth, EosActionNewAccount, EosActionRefund, EosActionSellRam, EosActionTransfer, EosActionUndelegate, EosActionUnknown, EosActionUnlinkAuth, EosActionUpdateAuth, EosActionVoteProducer, EosAsset, EosAuthorization, EosAuthorizationAccount, EosAuthorizationKey, EosAuthorizationWait, EosGetPublicKey, EosPermissionLevel, EosPublicKey, EosSignTx, EosSignedTx, EosTxActionAck, EosTxActionRequest, EosTxHeader, EthereumAccessList, EthereumAccessListOneKey, EthereumAddress, EthereumAddressOneKey, EthereumAuthorizationOneKey, EthereumAuthorizationSignature, EthereumDataType, EthereumDataTypeOneKey, EthereumDefinitionType, EthereumDefinitions, EthereumFieldType, EthereumFieldTypeOneKey, EthereumGetAddress, EthereumGetAddressOneKey, EthereumGetPublicKey, EthereumGetPublicKeyOneKey, EthereumGnosisSafeTxAck, EthereumGnosisSafeTxOperation, EthereumGnosisSafeTxRequest, EthereumMessageSignature, EthereumMessageSignatureOneKey, EthereumNetworkInfo, EthereumPublicKey, EthereumPublicKeyOneKey, EthereumSignMessage, EthereumSignMessageEIP712, EthereumSignMessageOneKey, EthereumSignTx, EthereumSignTxEIP1559, EthereumSignTxEIP1559OneKey, EthereumSignTxEIP7702OneKey, EthereumSignTxOneKey, EthereumSignTypedData, EthereumSignTypedDataOneKey, EthereumSignTypedHash, EthereumSignTypedHashOneKey, EthereumStructMember, EthereumStructMemberOneKey, EthereumTokenInfo, EthereumTxAck, EthereumTxAckOneKey, EthereumTxRequest, EthereumTxRequestOneKey, EthereumTypedDataSignature, EthereumTypedDataSignatureOneKey, EthereumTypedDataStructAck, EthereumTypedDataStructAckOneKey, EthereumTypedDataStructRequest, EthereumTypedDataStructRequestOneKey, EthereumTypedDataValueAck, EthereumTypedDataValueAckOneKey, EthereumTypedDataValueRequest, EthereumTypedDataValueRequestOneKey, EthereumVerifyMessage, EthereumVerifyMessageOneKey, ExportType, FactoryDeviceInfo, FactoryDeviceInfoSettings, FactoryGetDeviceInfo, Failure, FailureType, Features, FileInfo, FileInfoList, FilecoinAddress, FilecoinGetAddress, FilecoinSignTx, FilecoinSignedTx, FilesystemDir, FilesystemDirList, FilesystemDirMake, FilesystemDirRemove, FilesystemDiskControl, FilesystemFile, FilesystemFileDelete, FilesystemFileRead, FilesystemFileWrite, FilesystemFixPermission, FilesystemFormat, FilesystemPathInfo, FilesystemPathInfoQuery, FirmwareErase, FirmwareErase_ex, FirmwareHash, FirmwareRequest, FirmwareUpdateEmmc, FirmwareUpload, GetAddress, GetDeviceInfo, GetECDHSessionKey, GetEntropy, GetFeatures, GetFirmwareHash, GetNextU2FCounter, GetNonce, GetOwnershipId, GetOwnershipProof, GetPassphraseState, GetProtoVersion, GetPublicKey, GetPublicKeyMultiple, HDNodePathType, HDNodeType, IdentityType, Initialize, InputScriptType, InternalInputScriptType, KaspaAddress, KaspaGetAddress, KaspaSignTx, KaspaSignedTx, KaspaTxInputAck, KaspaTxInputRequest, ListResDir, LnurlAuth, LnurlAuthResp, LockDevice, LogBlockCommand, LowLevelDevice, LowlevelTransportSharedPlugin, MessageFromOneKey, MessageKey, MessageResponse, MessageResponseMap, MessageSignature, MessageType, messages as Messages, MoneroAccountPublicAddress, MoneroAddress, MoneroExportedKeyImage, MoneroGetAddress, MoneroGetTxKeyAck, MoneroGetTxKeyRequest, MoneroGetWatchKey, MoneroKeyImageExportInitAck, MoneroKeyImageExportInitRequest, MoneroKeyImageSyncFinalAck, MoneroKeyImageSyncFinalRequest, MoneroKeyImageSyncStepAck, MoneroKeyImageSyncStepRequest, MoneroLiveRefreshFinalAck, MoneroLiveRefreshFinalRequest, MoneroLiveRefreshStartAck, MoneroLiveRefreshStartRequest, MoneroLiveRefreshStepAck, MoneroLiveRefreshStepRequest, MoneroMultisigKLRki, MoneroNetworkType, MoneroOutputEntry, MoneroRctKeyPublic, MoneroRingCtSig, MoneroSubAddressIndicesList, MoneroTransactionAllInputsSetAck, MoneroTransactionAllInputsSetRequest, MoneroTransactionAllOutSetAck, MoneroTransactionAllOutSetRequest, MoneroTransactionData, MoneroTransactionDestinationEntry, MoneroTransactionFinalAck, MoneroTransactionFinalRequest, MoneroTransactionInitAck, MoneroTransactionInitRequest, MoneroTransactionInputViniAck, MoneroTransactionInputViniRequest, MoneroTransactionInputsPermutationAck, MoneroTransactionInputsPermutationRequest, MoneroTransactionRsigData, MoneroTransactionSetInputAck, MoneroTransactionSetInputRequest, MoneroTransactionSetOutputAck, MoneroTransactionSetOutputRequest, MoneroTransactionSignInputAck, MoneroTransactionSignInputRequest, MoneroTransactionSourceEntry, MoneroTransferDetails, MoneroWatchKey, MultisigRedeemScriptType, NEMAddress, NEMAggregateModification, NEMCosignatoryModification, NEMDecryptMessage, NEMDecryptedMessage, NEMGetAddress, NEMImportanceTransfer, NEMImportanceTransferMode, NEMModificationType, NEMMosaic, NEMMosaicCreation, NEMMosaicDefinition, NEMMosaicLevy, NEMMosaicSupplyChange, NEMProvisionNamespace, NEMSignTx, NEMSignedTx, NEMSupplyChangeType, NEMTransactionCommon, NEMTransfer, NFTWriteData, NFTWriteInfo, NearAddress, NearGetAddress, NearSignTx, NearSignedTx, NeoAddress, NeoGetAddress, NeoSignTx, NeoSignedTx, NervosAddress, NervosGetAddress, NervosSignTx, NervosSignedTx, NervosTxAck, NervosTxRequest, NexaAddress, NexaGetAddress, NexaSignTx, NexaSignedTx, NexaTxInputAck, NexaTxInputRequest, NextU2FCounter, Nonce, NostrDecryptMessage, NostrDecryptedMessage, NostrEncryptMessage, NostrEncryptedMessage, NostrGetPublicKey, NostrPublicKey, NostrSignEvent, NostrSignSchnorr, NostrSignedEvent, NostrSignedSchnorr, OnboardingStep, OneKeyDeviceCommType, OneKeyDeviceInfo, OneKeyDeviceInfoBase, OneKeyDeviceInfoWithSession, OneKeyDeviceType, OneKeyMobileDeviceInfo, OneKeySEState, OneKeySeType, OnekeyFeatures, OnekeyGetFeatures, OutputScriptType, OwnershipId, OwnershipProof, PROTOCOL_V1_CHUNK_PAYLOAD_SIZE, PROTOCOL_V1_ENVELOPE_HEADER_SIZE, PROTOCOL_V1_HEADER_BYTE, PROTOCOL_V1_MESSAGE_HEADER_SIZE, PROTOCOL_V1_REPORT_ID, PROTOCOL_V1_USB_PACKET_SIZE, PROTOCOL_V2_BLE_FILE_CHUNK_SIZE, PROTOCOL_V2_CHANNEL_BLE_UART, PROTOCOL_V2_CHANNEL_SOCKET, PROTOCOL_V2_CHANNEL_USB, PROTOCOL_V2_FILE_CHUNK_SIZE, PROTOCOL_V2_FRAME_MAX_BYTES, PROTOCOL_V2_PACKET_SRC_COMMAND, PROTOCOL_V2_SYS_MESSAGE_THRESHOLD, PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE, PassphraseAck, PassphraseRequest, PassphraseState, Path, PaymentRequestMemo, PinMatrixAck, PinMatrixRequest, PinMatrixRequestType, Ping, PolkadotAddress, PolkadotGetAddress, PolkadotSignTx, PolkadotSignedTx, PreauthorizedRequest, PrevInput, PrevOutput, PrevTx, ProtoVersion, ProtocolType, ProtocolV1, ProtocolV2, ProtocolV2CallOptions, ProtocolV2DeviceInfo, ProtocolV2FrameAssembler, ProtocolV2Schemas, ProtocolV2Session, ProtocolV2SessionOptions, PublicKey, PublicKeyMultiple, ReadSEPublicCert, ReadSEPublicKey, Reboot, RebootToBoardloader, RebootToBootloader, RebootType, RecoveryDevice, RecoveryDeviceType, RefundMemo, RequestType, ResetDevice, ResourceAck, ResourceRequest, ResourceType, ResourceUpdate, ResourceUpload, RippleAddress, RippleGetAddress, RipplePayment, RippleSignTx, RippleSignedTx, SEMessageSignature, SEPublicCert, SEPublicKey, SESignMessage, SafetyCheckLevel, ScdoAddress, ScdoGetAddress, ScdoSignMessage, ScdoSignTx, ScdoSignedMessage, ScdoSignedTx, ScdoTxAck, SdProtect, SdProtectOperationType, SeedRequestType, SelfTest, SetBusy, SetU2FCounter, SignIdentity, SignMessage, SignPsbt, SignTx, SignedIdentity, SignedPsbt, SolanaAddress, SolanaGetAddress, SolanaMessageSignature, SolanaOffChainMessageFormat, SolanaOffChainMessageVersion, SolanaSignOffChainMessage, SolanaSignTx, SolanaSignUnsafeMessage, SolanaSignedTx, SolanaTxATADetails, SolanaTxExtraInfo, SpiFlashData, SpiFlashRead, SpiFlashWrite, StarcoinAddress, StarcoinGetAddress, StarcoinGetPublicKey, StarcoinMessageSignature, StarcoinPublicKey, StarcoinSignMessage, StarcoinSignTx, StarcoinSignedTx, StarcoinVerifyMessage, StellarAccountMergeOp, StellarAddress, StellarAllowTrustOp, StellarAsset, StellarAssetType, StellarBumpSequenceOp, StellarChangeTrustOp, StellarCreateAccountOp, StellarCreatePassiveSellOfferOp, StellarGetAddress, StellarInvokeHostFunctionOp, StellarManageBuyOfferOp, StellarManageDataOp, StellarManageSellOfferOp, StellarMemoType, StellarPathPaymentStrictReceiveOp, StellarPathPaymentStrictSendOp, StellarPaymentOp, StellarRequestType, StellarSetOptionsOp, StellarSignTx, StellarSignedTx, StellarSignerType, StellarSorobanDataAck, StellarSorobanDataRequest, StellarTxOpRequest, Success, SuiAddress, SuiGetAddress, SuiMessageSignature, SuiSignMessage, SuiSignTx, SuiSignedTx, SuiTxAck, SuiTxRequest, TextMemo, TezosAddress, TezosBallotOp, TezosBallotType, TezosContractID, TezosContractType, TezosDelegationOp, TezosGetAddress, TezosGetPublicKey, TezosManagerTransfer, TezosOriginationOp, TezosParametersManager, TezosProposalOp, TezosPublicKey, TezosRevealOp, TezosSignTx, TezosSignedTx, TezosTransactionOp, TonAddress, TonGetAddress, TonSignData, TonSignDataType, TonSignMessage, TonSignProof, TonSignedData, TonSignedMessage, TonSignedProof, TonTxAck, TonWalletVersion, TonWorkChain, Transport, TransportCallOptions, TronAddress, TronCancelAllUnfreezeV2Contract, TronContract, TronDelegateResourceContract, TronFreezeBalanceContract, TronFreezeBalanceV2Contract, TronGetAddress, TronMessageSignature, TronMessageType, TronResourceCode, TronSignMessage, TronSignTx, TronSignedTx, TronTransferContract, TronTriggerSmartContract, TronUnDelegateResourceContract, TronUnfreezeBalanceContract, TronUnfreezeBalanceV2Contract, TronVoteWitnessContract, TronWithdrawBalanceContract, TronWithdrawExpireUnfreezeContract, TxAck, TxAckInput, TxAckInputWrapper, TxAckOutput, TxAckOutputWrapper, TxAckPaymentRequest, TxAckPrevExtraData, TxAckPrevExtraDataWrapper, TxAckPrevInput, TxAckPrevInputWrapper, TxAckPrevMeta, TxAckPrevOutput, TxAckPrevOutputWrapper, TxAckResponse, TxDetailsAddress, TxDetailsAmount, TxDetailsDisplayType, TxDetailsGeneral, TxDetailsNetwork, TxDetailsPage, TxInput, TxInputType, TxOutput, TxOutputBinType, TxOutputType, TxRequest, TxRequestDetailsType, TxRequestSerializedType, TypedCall, UintType, UnLockDevice, UnLockDeviceResponse, UnlockPath, UnlockedPathRequest, UpgradeFileHeader, VerifyMessage, Vote, WL_OperationType, WipeDevice, WordAck, WordRequest, WordRequestType, WriteSEPrivateKey, WriteSEPublicCert, ZoomRequest, bytesToHex, concatUint8Arrays, _default as default, experimental_field, experimental_message, facotry, getErrorMessage, hexToBytes, probeProtocolV2, index as protocolV1, protocolV2Codec as protocolV2, withProtocolTimeout };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAG7C,OAAO,EAKL,cAAc,EACf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,eAAe,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAEL,iBAAiB,EACjB,UAAU,EAEV,eAAe,EACf,UAAU,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAKlD,YAAY,EACV,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,2BAA2B,EAC3B,iBAAiB,EACjB,oBAAoB,EACpB,6BAA6B,EAC7B,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AAExC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,UAAU,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,gBAAgB,CAAC;AAC7C,cAAc,wBAAwB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAG7C,OAAO,EAKL,cAAc,EACf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,eAAe,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAEL,iBAAiB,EACjB,UAAU,EAEV,eAAe,EACf,UAAU,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAKlD,YAAY,EACV,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,2BAA2B,EAC3B,iBAAiB,EACjB,oBAAoB,EACpB,6BAA6B,EAC7B,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AAExC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,UAAU,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,gBAAgB,CAAC;AAC7C,cAAc,wBAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEvC,wBAmBE"}
|
package/dist/index.js
CHANGED
|
@@ -401,8 +401,15 @@ function crc8(data, len) {
|
|
|
401
401
|
return crc;
|
|
402
402
|
}
|
|
403
403
|
|
|
404
|
+
function logProtocolV2Debug(options, stage, details) {
|
|
405
|
+
var _a, _b, _c;
|
|
406
|
+
(_b = (_a = options === null || options === void 0 ? void 0 : options.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, `[${(_c = options.logPrefix) !== null && _c !== void 0 ? _c : 'ProtocolV2'}] ${stage}`, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (options.context ? { context: options.context } : {})), (options.messageName ? { messageName: options.messageName } : {})), (options.messageTypeId !== undefined ? { messageTypeId: options.messageTypeId } : {})), (options.pbPayloadLength !== undefined ? { pbPayloadLength: options.pbPayloadLength } : {})), details));
|
|
407
|
+
}
|
|
408
|
+
|
|
404
409
|
let protoSeq = 0;
|
|
405
|
-
function encodeFrame(payload, packetSrc
|
|
410
|
+
function encodeFrame(payload, packetSrc, router, debugOptions) {
|
|
411
|
+
const resolvedPacketSrc = packetSrc !== null && packetSrc !== void 0 ? packetSrc : 0;
|
|
412
|
+
const resolvedRouter = router !== null && router !== void 0 ? router : 0;
|
|
406
413
|
const payloadLen = payload ? payload.length : 0;
|
|
407
414
|
const frameLen = payloadLen + PROTO_HEAD_CRC_SIZE;
|
|
408
415
|
if (frameLen > PROTOCOL_V2_FRAME_MAX_BYTES) {
|
|
@@ -417,25 +424,35 @@ function encodeFrame(payload, packetSrc = 0, router = 0) {
|
|
|
417
424
|
frame[1] = frameLen % 256;
|
|
418
425
|
frame[2] = Math.floor(frameLen / 256) % 256;
|
|
419
426
|
frame[3] = 0;
|
|
420
|
-
frame[4] =
|
|
421
|
-
frame[5] = (
|
|
427
|
+
frame[4] = resolvedRouter % 256;
|
|
428
|
+
frame[5] = (resolvedPacketSrc % 16) * 4 + (PROTO_DATA_TYPE_PACKET % 4);
|
|
422
429
|
frame[6] = protoSeq;
|
|
423
430
|
frame[3] = crc8(frame, 3);
|
|
424
431
|
if (payload && payloadLen > 0) {
|
|
425
432
|
frame.set(payload, 7);
|
|
426
433
|
}
|
|
427
434
|
frame[frameLen - 1] = crc8(frame, frameLen - 1);
|
|
435
|
+
logProtocolV2Debug(debugOptions, 'encode raw frame', {
|
|
436
|
+
frameLen,
|
|
437
|
+
payloadLen,
|
|
438
|
+
packetSrc: resolvedPacketSrc,
|
|
439
|
+
router: frame[4],
|
|
440
|
+
attr: frame[5],
|
|
441
|
+
seq: frame[6],
|
|
442
|
+
headerCrc: frame[3],
|
|
443
|
+
frameCrc: frame[frameLen - 1],
|
|
444
|
+
});
|
|
428
445
|
return frame;
|
|
429
446
|
}
|
|
430
|
-
function encodeProtobufFrame(messageTypeId, pbPayload, packetSrc
|
|
447
|
+
function encodeProtobufFrame(messageTypeId, pbPayload, packetSrc, router, debugOptions) {
|
|
431
448
|
const payload = new Uint8Array(2 + pbPayload.length);
|
|
432
449
|
payload[0] = messageTypeId % 256;
|
|
433
450
|
payload[1] = Math.floor(messageTypeId / 256) % 256;
|
|
434
451
|
payload.set(pbPayload, 2);
|
|
435
|
-
return encodeFrame(payload, packetSrc, router);
|
|
452
|
+
return encodeFrame(payload, packetSrc, router, Object.assign(Object.assign({}, debugOptions), { messageTypeId, pbPayloadLength: pbPayload.length }));
|
|
436
453
|
}
|
|
437
454
|
|
|
438
|
-
function decodeFrame(data) {
|
|
455
|
+
function decodeFrame(data, debugOptions) {
|
|
439
456
|
if (data.length < PROTO_HEAD_CRC_SIZE) {
|
|
440
457
|
throw new Error(`Protocol V2 frame too short: ${data.length} bytes`);
|
|
441
458
|
}
|
|
@@ -465,6 +482,19 @@ function decodeFrame(data) {
|
|
|
465
482
|
}
|
|
466
483
|
const messageTypeId = payloadData[0] + payloadData[1] * 256;
|
|
467
484
|
const pbPayload = payloadData.slice(2);
|
|
485
|
+
logProtocolV2Debug(debugOptions, 'decode raw frame', {
|
|
486
|
+
frameLen,
|
|
487
|
+
dataLength: data.length,
|
|
488
|
+
router: data[4],
|
|
489
|
+
attr: data[5],
|
|
490
|
+
seq,
|
|
491
|
+
headerCrc: data[3],
|
|
492
|
+
expectedHeaderCrc,
|
|
493
|
+
frameCrc: data[frameLen - 1],
|
|
494
|
+
expectedFrameCrc,
|
|
495
|
+
messageTypeId,
|
|
496
|
+
pbPayloadLength: pbPayload.length,
|
|
497
|
+
});
|
|
468
498
|
return { messageTypeId, pbPayload, seq };
|
|
469
499
|
}
|
|
470
500
|
|
|
@@ -519,6 +549,7 @@ var protocolV2Codec = /*#__PURE__*/Object.freeze({
|
|
|
519
549
|
PROTO_DATA_TYPE_PACKET: PROTO_DATA_TYPE_PACKET,
|
|
520
550
|
CRC8_TABLE: CRC8_TABLE,
|
|
521
551
|
crc8: crc8,
|
|
552
|
+
logProtocolV2Debug: logProtocolV2Debug,
|
|
522
553
|
encodeFrame: encodeFrame,
|
|
523
554
|
encodeProtobufFrame: encodeProtobufFrame,
|
|
524
555
|
decodeFrame: decodeFrame,
|
|
@@ -553,19 +584,45 @@ const ProtocolV1 = {
|
|
|
553
584
|
};
|
|
554
585
|
const ProtocolV2 = {
|
|
555
586
|
encodeFrame(schemas, name, data, options = {}) {
|
|
587
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
556
588
|
const encodeMessages = resolveProtocolV2EncodeSchema(name, schemas);
|
|
557
589
|
const { Message, messageTypeId } = createMessageFromName(encodeMessages, name);
|
|
558
590
|
const pbBuffer = encode(Message, data);
|
|
559
591
|
pbBuffer.reset();
|
|
560
592
|
const rawPbBuffer = pbBuffer.toBuffer();
|
|
561
593
|
const pbBytes = new Uint8Array(rawPbBuffer);
|
|
562
|
-
|
|
594
|
+
(_b = (_a = options.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, `[${(_c = options.logPrefix) !== null && _c !== void 0 ? _c : 'ProtocolV2'}] encode protobuf`, {
|
|
595
|
+
context: (_d = options.context) !== null && _d !== void 0 ? _d : `encode:${name}`,
|
|
596
|
+
messageName: name,
|
|
597
|
+
messageTypeId,
|
|
598
|
+
pbPayloadLength: pbBytes.length,
|
|
599
|
+
packetSrc: (_e = options.packetSrc) !== null && _e !== void 0 ? _e : 0,
|
|
600
|
+
router: (_f = options.router) !== null && _f !== void 0 ? _f : 0,
|
|
601
|
+
});
|
|
602
|
+
return encodeProtobufFrame(messageTypeId, pbBytes, options.packetSrc, options.router, {
|
|
603
|
+
logger: options.logger,
|
|
604
|
+
logPrefix: options.logPrefix,
|
|
605
|
+
context: (_g = options.context) !== null && _g !== void 0 ? _g : `encode:${name}`,
|
|
606
|
+
messageName: name,
|
|
607
|
+
});
|
|
563
608
|
},
|
|
564
|
-
decodeFrame(schemas, frame) {
|
|
565
|
-
|
|
609
|
+
decodeFrame(schemas, frame, options = {}) {
|
|
610
|
+
var _a, _b, _c, _d, _e;
|
|
611
|
+
const { messageTypeId, pbPayload, seq } = decodeFrame(frame, {
|
|
612
|
+
logger: options.logger,
|
|
613
|
+
logPrefix: options.logPrefix,
|
|
614
|
+
context: (_a = options.context) !== null && _a !== void 0 ? _a : 'decode',
|
|
615
|
+
});
|
|
566
616
|
const { Message, messageName } = createProtocolV2MessageFromType(messageTypeId, schemas);
|
|
567
617
|
const rxByteBuffer = ByteBuffer__default["default"].wrap(Buffer.from(pbPayload));
|
|
568
618
|
const message = decode(Message, rxByteBuffer);
|
|
619
|
+
(_c = (_b = options.logger) === null || _b === void 0 ? void 0 : _b.debug) === null || _c === void 0 ? void 0 : _c.call(_b, `[${(_d = options.logPrefix) !== null && _d !== void 0 ? _d : 'ProtocolV2'}] decode protobuf`, {
|
|
620
|
+
context: (_e = options.context) !== null && _e !== void 0 ? _e : `decode:${messageName}`,
|
|
621
|
+
messageName,
|
|
622
|
+
messageTypeId,
|
|
623
|
+
pbPayloadLength: pbPayload.length,
|
|
624
|
+
seq,
|
|
625
|
+
});
|
|
569
626
|
return {
|
|
570
627
|
message,
|
|
571
628
|
messageName,
|
|
@@ -846,12 +903,15 @@ class ProtocolV2Session {
|
|
|
846
903
|
const { schemas, router, packetSrc = PROTOCOL_V2_PACKET_SRC_COMMAND, writeFrame, readFrame, logger, logPrefix = 'ProtocolV2', createTimeoutError, } = this.options;
|
|
847
904
|
const callPromise = () => __awaiter(this, void 0, void 0, function* () {
|
|
848
905
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
906
|
+
const shouldReduceDebug = shouldReduceProtocolV2Debug(name);
|
|
849
907
|
const frame = ProtocolV2.encodeFrame(schemas, name, data, {
|
|
850
908
|
packetSrc,
|
|
851
909
|
router,
|
|
910
|
+
logger: shouldReduceDebug ? undefined : logger,
|
|
911
|
+
logPrefix,
|
|
912
|
+
context: `tx:${name}`,
|
|
852
913
|
});
|
|
853
914
|
const expectedSeq = frame[6];
|
|
854
|
-
const shouldReduceDebug = shouldReduceProtocolV2Debug(name);
|
|
855
915
|
if (!shouldReduceDebug) {
|
|
856
916
|
(_a = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _a === void 0 ? void 0 : _a.call(logger, `[${logPrefix}] TX payload name=${name}`, sanitizeProtocolV2DebugPayload(data));
|
|
857
917
|
(_b = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _b === void 0 ? void 0 : _b.call(logger, `[${logPrefix}] TX frame name=${name} len=${frame.length} router=${frame[4]} attr=${frame[5]} seq=${expectedSeq} hex=${bytesToDebugHex(frame)}`);
|
|
@@ -862,7 +922,11 @@ class ProtocolV2Session {
|
|
|
862
922
|
if (!shouldReduceDebug) {
|
|
863
923
|
(_c = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _c === void 0 ? void 0 : _c.call(logger, `[${logPrefix}] RX frame len=${rxFrame.length} router=${rxFrame[4]} attr=${rxFrame[5]} seq=${rxFrame[6]} hex=${bytesToDebugHex(rxFrame)}`);
|
|
864
924
|
}
|
|
865
|
-
const decoded = ProtocolV2.decodeFrame(schemas, rxFrame
|
|
925
|
+
const decoded = ProtocolV2.decodeFrame(schemas, rxFrame, {
|
|
926
|
+
logger: shouldReduceDebug ? undefined : logger,
|
|
927
|
+
logPrefix,
|
|
928
|
+
context: `rx:${name}`,
|
|
929
|
+
});
|
|
866
930
|
if (!shouldReduceDebug && decoded.seq !== expectedSeq) {
|
|
867
931
|
(_d = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _d === void 0 ? void 0 : _d.call(logger, `[${logPrefix}] seq differs for ${name}: tx=${expectedSeq}, rx=${decoded.seq}`);
|
|
868
932
|
}
|
|
@@ -1392,6 +1456,20 @@ exports.DeviceFirmwareTargetType = void 0;
|
|
|
1392
1456
|
DeviceFirmwareTargetType[DeviceFirmwareTargetType["TARGET_SE"] = 6] = "TARGET_SE";
|
|
1393
1457
|
DeviceFirmwareTargetType[DeviceFirmwareTargetType["TARGET_RESOURCE"] = 10] = "TARGET_RESOURCE";
|
|
1394
1458
|
})(exports.DeviceFirmwareTargetType || (exports.DeviceFirmwareTargetType = {}));
|
|
1459
|
+
exports.OnboardingStep = void 0;
|
|
1460
|
+
(function (OnboardingStep) {
|
|
1461
|
+
OnboardingStep[OnboardingStep["UNKNOWN"] = 0] = "UNKNOWN";
|
|
1462
|
+
OnboardingStep[OnboardingStep["SECURITY_CHECK"] = 1] = "SECURITY_CHECK";
|
|
1463
|
+
OnboardingStep[OnboardingStep["PIN"] = 2] = "PIN";
|
|
1464
|
+
OnboardingStep[OnboardingStep["SETUP_CHOICE"] = 3] = "SETUP_CHOICE";
|
|
1465
|
+
OnboardingStep[OnboardingStep["CREATE_NEW"] = 4] = "CREATE_NEW";
|
|
1466
|
+
OnboardingStep[OnboardingStep["SEEDCARD_BACKUP"] = 5] = "SEEDCARD_BACKUP";
|
|
1467
|
+
OnboardingStep[OnboardingStep["RESTORE_CHOICE"] = 6] = "RESTORE_CHOICE";
|
|
1468
|
+
OnboardingStep[OnboardingStep["RESTORE_MNEMONIC"] = 7] = "RESTORE_MNEMONIC";
|
|
1469
|
+
OnboardingStep[OnboardingStep["RESTORE_MNEMONIC_SEEDCARD_BACKUP"] = 8] = "RESTORE_MNEMONIC_SEEDCARD_BACKUP";
|
|
1470
|
+
OnboardingStep[OnboardingStep["RESTORE_SEEDCARD"] = 9] = "RESTORE_SEEDCARD";
|
|
1471
|
+
OnboardingStep[OnboardingStep["DONE"] = 100] = "DONE";
|
|
1472
|
+
})(exports.OnboardingStep || (exports.OnboardingStep = {}));
|
|
1395
1473
|
|
|
1396
1474
|
var messages = /*#__PURE__*/Object.freeze({
|
|
1397
1475
|
__proto__: null,
|
|
@@ -1461,7 +1539,8 @@ var messages = /*#__PURE__*/Object.freeze({
|
|
|
1461
1539
|
get DeviceType () { return exports.DeviceType; },
|
|
1462
1540
|
get DeviceSeType () { return exports.DeviceSeType; },
|
|
1463
1541
|
get DeviceSEState () { return exports.DeviceSEState; },
|
|
1464
|
-
get DeviceFirmwareTargetType () { return exports.DeviceFirmwareTargetType; }
|
|
1542
|
+
get DeviceFirmwareTargetType () { return exports.DeviceFirmwareTargetType; },
|
|
1543
|
+
get OnboardingStep () { return exports.OnboardingStep; }
|
|
1465
1544
|
});
|
|
1466
1545
|
|
|
1467
1546
|
protobuf__namespace.util.Long = Long__default["default"];
|
|
@@ -3,6 +3,7 @@ import ByteBuffer from 'bytebuffer';
|
|
|
3
3
|
import { encodeEnvelopeMessage } from './v1/packets';
|
|
4
4
|
import { decodeMessage as decodeV1Message } from './v1/receive';
|
|
5
5
|
import type { Root } from 'protobufjs/light';
|
|
6
|
+
import type { ProtocolV2DebugLogger } from './v2';
|
|
6
7
|
export declare const PROTOCOL_V2_SYS_MESSAGE_THRESHOLD = 60000;
|
|
7
8
|
type ProtocolV2Schemas = {
|
|
8
9
|
protocolV1: Root;
|
|
@@ -11,6 +12,9 @@ type ProtocolV2Schemas = {
|
|
|
11
12
|
type ProtocolV2FrameOptions = {
|
|
12
13
|
packetSrc?: number;
|
|
13
14
|
router?: number;
|
|
15
|
+
logger?: ProtocolV2DebugLogger;
|
|
16
|
+
logPrefix?: string;
|
|
17
|
+
context?: string;
|
|
14
18
|
};
|
|
15
19
|
export declare const ProtocolV1: {
|
|
16
20
|
encodeEnvelope: typeof encodeEnvelopeMessage;
|
|
@@ -25,7 +29,7 @@ export declare const ProtocolV1: {
|
|
|
25
29
|
};
|
|
26
30
|
export declare const ProtocolV2: {
|
|
27
31
|
encodeFrame(schemas: ProtocolV2Schemas, name: string, data: Record<string, unknown>, options?: ProtocolV2FrameOptions): Uint8Array;
|
|
28
|
-
decodeFrame(schemas: ProtocolV2Schemas, frame: Uint8Array): {
|
|
32
|
+
decodeFrame(schemas: ProtocolV2Schemas, frame: Uint8Array, options?: Pick<ProtocolV2FrameOptions, 'logger' | 'logPrefix' | 'context'>): {
|
|
29
33
|
message: {
|
|
30
34
|
[key: string]: any;
|
|
31
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/protocols/index.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,qBAAqB,EAA+C,MAAM,cAAc,CAAC;AAElG,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAMhE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/protocols/index.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,qBAAqB,EAA+C,MAAM,cAAc,CAAC;AAElG,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAMhE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,MAAM,CAAC;AAElD,eAAO,MAAM,iCAAiC,QAAQ,CAAC;AAEvD,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAmBF,eAAO,MAAM,UAAU;;;;;;;;;;CAOtB,CAAC;AAEF,eAAO,MAAM,UAAU;yBAEV,iBAAiB,QACpB,MAAM,QACN,OAAO,MAAM,EAAE,OAAO,CAAC,YACpB,sBAAsB;yBA2BtB,iBAAiB,SACnB,UAAU,YACR,KAAK,sBAAsB,EAAE,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;;;;;;;;;;CA4B5E,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ProtocolV2DebugLogger = {
|
|
2
|
+
debug?: (...args: unknown[]) => void;
|
|
3
|
+
};
|
|
4
|
+
export type ProtocolV2FrameDebugOptions = {
|
|
5
|
+
logger?: ProtocolV2DebugLogger;
|
|
6
|
+
logPrefix?: string;
|
|
7
|
+
context?: string;
|
|
8
|
+
messageName?: string;
|
|
9
|
+
messageTypeId?: number;
|
|
10
|
+
pbPayloadLength?: number;
|
|
11
|
+
};
|
|
12
|
+
export declare function logProtocolV2Debug(options: ProtocolV2FrameDebugOptions | undefined, stage: string, details: Record<string, unknown>): void;
|
|
13
|
+
//# sourceMappingURL=debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/debug.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,2BAA2B,GAAG,SAAS,EAChD,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QASjC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { ProtocolV2FrameDebugOptions } from './debug';
|
|
1
2
|
export interface ProtoV2Frame {
|
|
2
3
|
messageTypeId: number;
|
|
3
4
|
pbPayload: Uint8Array;
|
|
4
5
|
seq: number;
|
|
5
6
|
}
|
|
6
|
-
export declare function decodeFrame(data: Uint8Array): ProtoV2Frame;
|
|
7
|
+
export declare function decodeFrame(data: Uint8Array, debugOptions?: ProtocolV2FrameDebugOptions): ProtoV2Frame;
|
|
7
8
|
//# sourceMappingURL=decode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/decode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/decode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAE3D,MAAM,WAAW,YAAY;IAE3B,aAAa,EAAE,MAAM,CAAC;IAEtB,SAAS,EAAE,UAAU,CAAC;IAEtB,GAAG,EAAE,MAAM,CAAC;CACb;AAYD,wBAAgB,WAAW,CACzB,IAAI,EAAE,UAAU,EAChB,YAAY,CAAC,EAAE,2BAA2B,GACzC,YAAY,CA+Dd"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
1
|
+
import type { ProtocolV2FrameDebugOptions } from './debug';
|
|
2
|
+
export declare function encodeFrame(payload: Uint8Array | null, packetSrc?: number, router?: number, debugOptions?: ProtocolV2FrameDebugOptions): Uint8Array;
|
|
3
|
+
export declare function encodeProtobufFrame(messageTypeId: number, pbPayload: Uint8Array, packetSrc?: number, router?: number, debugOptions?: ProtocolV2FrameDebugOptions): Uint8Array;
|
|
3
4
|
//# sourceMappingURL=encode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/encode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/encode.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAmB3D,wBAAgB,WAAW,CACzB,OAAO,EAAE,UAAU,GAAG,IAAI,EAC1B,SAAS,CAAC,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,2BAA2B,GACzC,UAAU,CA8CZ;AASD,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,UAAU,EACrB,SAAS,CAAC,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,2BAA2B,GACzC,UAAU,CAUZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAKhF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,SAAS,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,KAAK,CAAC;CACjE,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,sBAAsB,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAChE,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,CAAC;AAEvD,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAQlD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIpD;AA0ID,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,UAQ7C;AAED,wBAAsB,mBAAmB,CAAC,CAAC,EACzC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,kBAAkB,EAAE,MAAM,KAAK,GAC9B,OAAO,CAAC,CAAC,CAAC,CAcZ;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;gBAEvC,OAAO,EAAE,wBAAwB;IAI7C,IAAI,CACF,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,WAAW,GAAE,qBAA0B,GACtC,OAAO,CAAC,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAKhF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,SAAS,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,KAAK,CAAC;CACjE,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,sBAAsB,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAChE,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,CAAC;AAEvD,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAQlD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIpD;AA0ID,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,UAQ7C;AAED,wBAAsB,mBAAmB,CAAC,CAAC,EACzC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,kBAAkB,EAAE,MAAM,KAAK,GAC9B,OAAO,CAAC,CAAC,CAAC,CAcZ;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;gBAEvC,OAAO,EAAE,wBAAwB;IAI7C,IAAI,CACF,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,WAAW,GAAE,qBAA0B,GACtC,OAAO,CAAC,iBAAiB,CAAC;CA2F9B;AAED,wBAAsB,eAAe,CAAC,EACpC,IAAI,EACJ,SAAS,EACT,MAAM,EACN,SAAwB,EACxB,aAAa,EACb,aAAa,GACd,EAAE;IACD,IAAI,EAAE,CACJ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,qBAAqB,KAC5B,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC3C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC1D,oBAoBA"}
|