@onekeyfe/hd-shared 0.1.36 → 0.1.39
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/dist/HardwareError.d.ts +5 -0
- package/dist/HardwareError.d.ts.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +10 -0
- package/package.json +2 -2
- package/src/HardwareError.ts +27 -0
package/dist/HardwareError.d.ts
CHANGED
|
@@ -27,6 +27,9 @@ export declare const HardwareErrorCode: {
|
|
|
27
27
|
readonly DeviceInterruptedFromUser: 109;
|
|
28
28
|
readonly DeviceCheckDeviceIdError: 110;
|
|
29
29
|
readonly DeviceNotSupportPassphrase: 111;
|
|
30
|
+
readonly DeviceCheckPassphraseStateError: 112;
|
|
31
|
+
readonly DeviceNotOpenedPassphrase: 113;
|
|
32
|
+
readonly DeviceOpenedPassphrase: 114;
|
|
30
33
|
readonly NotInitialized: 200;
|
|
31
34
|
readonly IFrameNotInitialized: 300;
|
|
32
35
|
readonly IFrameAleradyInitialized: 301;
|
|
@@ -55,6 +58,7 @@ export declare const HardwareErrorCode: {
|
|
|
55
58
|
readonly BleMonitorError: 708;
|
|
56
59
|
readonly BleCharacteristicNotifyError: 709;
|
|
57
60
|
readonly BleWriteCharacteristicError: 710;
|
|
61
|
+
readonly BleAlreadyConnected: 711;
|
|
58
62
|
readonly RuntimeError: 800;
|
|
59
63
|
readonly PinInvalid: 801;
|
|
60
64
|
readonly PinCancelled: 802;
|
|
@@ -66,6 +70,7 @@ export declare const HardwareErrorCode: {
|
|
|
66
70
|
readonly BridgeNotInstalled: 808;
|
|
67
71
|
readonly PollingTimeout: 809;
|
|
68
72
|
readonly PollingStop: 810;
|
|
73
|
+
readonly BlindSignDisabled: 811;
|
|
69
74
|
};
|
|
70
75
|
export declare const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping;
|
|
71
76
|
export declare const TypedError: (hardwareError: ErrorCodeUnion | string, message?: string | undefined, params?: any) => HardwareError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HardwareError.d.ts","sourceRoot":"","sources":["../src/HardwareError.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,OAAO,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,GAAG,CAAC;CACd;AAED,aAAK,OAAO,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAE5C,aAAK,+BAA+B,GAAG;KAAG,CAAC,IAAI,OAAO,CAAC,OAAO,iBAAiB,CAAC,GAAG,MAAM;CAAE,CAAC;AAE5F,aAAK,cAAc,GAAG,OAAO,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAOxD,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAS,EAAE,cAAc,CAAkC;IAE3D,OAAO,SAAM;IAEb,MAAM,EAAE,GAAG,CAAM;gBAEL,aAAa,EAAE,cAAc,GAAG,MAAM;CAmBnD;AAED,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"HardwareError.d.ts","sourceRoot":"","sources":["../src/HardwareError.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,OAAO,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,GAAG,CAAC;CACd;AAED,aAAK,OAAO,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAE5C,aAAK,+BAA+B,GAAG;KAAG,CAAC,IAAI,OAAO,CAAC,OAAO,iBAAiB,CAAC,GAAG,MAAM;CAAE,CAAC;AAE5F,aAAK,cAAc,GAAG,OAAO,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAOxD,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAS,EAAE,cAAc,CAAkC;IAE3D,OAAO,SAAM;IAEb,MAAM,EAAE,GAAG,CAAM;gBAEL,aAAa,EAAE,cAAc,GAAG,MAAM;CAmBnD;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgPpB,CAAC;AAEX,eAAO,MAAM,wBAAwB,EAAE,+BAwF7B,CAAC;AAEX,eAAO,MAAM,UAAU,kBACN,cAAc,GAAG,MAAM,yCAE7B,GAAG,kBAMb,CAAC;AAEF,eAAO,MAAM,cAAc,YAAa,GAAG,QAY1C,CAAC;AAEF,eAAO,MAAM,oBAAoB,YAAa,MAAM,KAAG,aAOtD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,9 @@ declare const HardwareErrorCode: {
|
|
|
36
36
|
readonly DeviceInterruptedFromUser: 109;
|
|
37
37
|
readonly DeviceCheckDeviceIdError: 110;
|
|
38
38
|
readonly DeviceNotSupportPassphrase: 111;
|
|
39
|
+
readonly DeviceCheckPassphraseStateError: 112;
|
|
40
|
+
readonly DeviceNotOpenedPassphrase: 113;
|
|
41
|
+
readonly DeviceOpenedPassphrase: 114;
|
|
39
42
|
readonly NotInitialized: 200;
|
|
40
43
|
readonly IFrameNotInitialized: 300;
|
|
41
44
|
readonly IFrameAleradyInitialized: 301;
|
|
@@ -64,6 +67,7 @@ declare const HardwareErrorCode: {
|
|
|
64
67
|
readonly BleMonitorError: 708;
|
|
65
68
|
readonly BleCharacteristicNotifyError: 709;
|
|
66
69
|
readonly BleWriteCharacteristicError: 710;
|
|
70
|
+
readonly BleAlreadyConnected: 711;
|
|
67
71
|
readonly RuntimeError: 800;
|
|
68
72
|
readonly PinInvalid: 801;
|
|
69
73
|
readonly PinCancelled: 802;
|
|
@@ -75,6 +79,7 @@ declare const HardwareErrorCode: {
|
|
|
75
79
|
readonly BridgeNotInstalled: 808;
|
|
76
80
|
readonly PollingTimeout: 809;
|
|
77
81
|
readonly PollingStop: 810;
|
|
82
|
+
readonly BlindSignDisabled: 811;
|
|
78
83
|
};
|
|
79
84
|
declare const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping;
|
|
80
85
|
declare const TypedError: (hardwareError: ErrorCodeUnion | string, message?: string | undefined, params?: any) => HardwareError;
|
package/dist/index.js
CHANGED
|
@@ -96,6 +96,9 @@ const HardwareErrorCode = {
|
|
|
96
96
|
DeviceInterruptedFromUser: 109,
|
|
97
97
|
DeviceCheckDeviceIdError: 110,
|
|
98
98
|
DeviceNotSupportPassphrase: 111,
|
|
99
|
+
DeviceCheckPassphraseStateError: 112,
|
|
100
|
+
DeviceNotOpenedPassphrase: 113,
|
|
101
|
+
DeviceOpenedPassphrase: 114,
|
|
99
102
|
NotInitialized: 200,
|
|
100
103
|
IFrameNotInitialized: 300,
|
|
101
104
|
IFrameAleradyInitialized: 301,
|
|
@@ -124,6 +127,7 @@ const HardwareErrorCode = {
|
|
|
124
127
|
BleMonitorError: 708,
|
|
125
128
|
BleCharacteristicNotifyError: 709,
|
|
126
129
|
BleWriteCharacteristicError: 710,
|
|
130
|
+
BleAlreadyConnected: 711,
|
|
127
131
|
RuntimeError: 800,
|
|
128
132
|
PinInvalid: 801,
|
|
129
133
|
PinCancelled: 802,
|
|
@@ -135,6 +139,7 @@ const HardwareErrorCode = {
|
|
|
135
139
|
BridgeNotInstalled: 808,
|
|
136
140
|
PollingTimeout: 809,
|
|
137
141
|
PollingStop: 810,
|
|
142
|
+
BlindSignDisabled: 811,
|
|
138
143
|
};
|
|
139
144
|
const HardwareErrorCodeMessage = {
|
|
140
145
|
[HardwareErrorCode.UnknownError]: 'Unknown error occurred. Check message property.',
|
|
@@ -149,6 +154,9 @@ const HardwareErrorCodeMessage = {
|
|
|
149
154
|
[HardwareErrorCode.DeviceUnexpectedBootloaderMode]: 'Device should be in bootloader mode',
|
|
150
155
|
[HardwareErrorCode.DeviceCheckDeviceIdError]: 'Device Id in the features is not same.',
|
|
151
156
|
[HardwareErrorCode.DeviceNotSupportPassphrase]: 'Device not support passphrase',
|
|
157
|
+
[HardwareErrorCode.DeviceCheckPassphraseStateError]: 'Device passphrase state error',
|
|
158
|
+
[HardwareErrorCode.DeviceNotOpenedPassphrase]: 'Device not opened passphrase',
|
|
159
|
+
[HardwareErrorCode.DeviceOpenedPassphrase]: 'Device opened passphrase',
|
|
152
160
|
[HardwareErrorCode.NotInitialized]: 'Not initialized',
|
|
153
161
|
[HardwareErrorCode.IFrameNotInitialized]: 'IFrame not initialized',
|
|
154
162
|
[HardwareErrorCode.IFrameAleradyInitialized]: 'IFrame alerady initialized',
|
|
@@ -177,6 +185,7 @@ const HardwareErrorCodeMessage = {
|
|
|
177
185
|
[HardwareErrorCode.BleMonitorError]: 'Monitor Error: characteristic not found',
|
|
178
186
|
[HardwareErrorCode.BleCharacteristicNotifyError]: 'Characteristic Notify Error',
|
|
179
187
|
[HardwareErrorCode.BleWriteCharacteristicError]: 'Write Characteristic Error',
|
|
188
|
+
[HardwareErrorCode.BleAlreadyConnected]: 'Already connected to device',
|
|
180
189
|
[HardwareErrorCode.RuntimeError]: 'Runtime error',
|
|
181
190
|
[HardwareErrorCode.PinInvalid]: 'Pin invalid',
|
|
182
191
|
[HardwareErrorCode.PinCancelled]: 'Pin cancelled',
|
|
@@ -188,6 +197,7 @@ const HardwareErrorCodeMessage = {
|
|
|
188
197
|
[HardwareErrorCode.BridgeNotInstalled]: 'Bridge not installed',
|
|
189
198
|
[HardwareErrorCode.PollingTimeout]: 'Polling timeout',
|
|
190
199
|
[HardwareErrorCode.PollingStop]: 'Polling stop',
|
|
200
|
+
[HardwareErrorCode.BlindSignDisabled]: 'Please confirm the BlindSign enabled',
|
|
191
201
|
};
|
|
192
202
|
const TypedError = (hardwareError, message, params) => {
|
|
193
203
|
if (typeof hardwareError === 'string') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-shared",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39",
|
|
4
4
|
"description": "Hardware SDK's shared tool library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Hardware-SDK",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"lint": "eslint .",
|
|
26
26
|
"lint:fix": "eslint . --fix"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "abaee3140debec0a263b2b87c5ffcddfa534b443"
|
|
29
29
|
}
|
package/src/HardwareError.ts
CHANGED
|
@@ -102,9 +102,25 @@ export const HardwareErrorCode = {
|
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
104
|
* Do not support passphrase
|
|
105
|
+
* @params: { require: string }
|
|
105
106
|
*/
|
|
106
107
|
DeviceNotSupportPassphrase: 111,
|
|
107
108
|
|
|
109
|
+
/*
|
|
110
|
+
* Device passphrase state error
|
|
111
|
+
*/
|
|
112
|
+
DeviceCheckPassphraseStateError: 112,
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* use passphrase, but passphrase is not opened
|
|
116
|
+
*/
|
|
117
|
+
DeviceNotOpenedPassphrase: 113,
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* not use passphrase, but passphrase is opened
|
|
121
|
+
*/
|
|
122
|
+
DeviceOpenedPassphrase: 114,
|
|
123
|
+
|
|
108
124
|
/**
|
|
109
125
|
* Not initialized
|
|
110
126
|
*/
|
|
@@ -206,6 +222,7 @@ export const HardwareErrorCode = {
|
|
|
206
222
|
BleMonitorError: 708,
|
|
207
223
|
BleCharacteristicNotifyError: 709,
|
|
208
224
|
BleWriteCharacteristicError: 710,
|
|
225
|
+
BleAlreadyConnected: 711,
|
|
209
226
|
|
|
210
227
|
/**
|
|
211
228
|
* Hardware runtiome errors
|
|
@@ -261,6 +278,11 @@ export const HardwareErrorCode = {
|
|
|
261
278
|
* ensure connect stop polling
|
|
262
279
|
*/
|
|
263
280
|
PollingStop: 810,
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Device does not open blid sign
|
|
284
|
+
*/
|
|
285
|
+
BlindSignDisabled: 811,
|
|
264
286
|
} as const;
|
|
265
287
|
|
|
266
288
|
export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
|
|
@@ -280,6 +302,9 @@ export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
|
|
|
280
302
|
[HardwareErrorCode.DeviceUnexpectedBootloaderMode]: 'Device should be in bootloader mode',
|
|
281
303
|
[HardwareErrorCode.DeviceCheckDeviceIdError]: 'Device Id in the features is not same.',
|
|
282
304
|
[HardwareErrorCode.DeviceNotSupportPassphrase]: 'Device not support passphrase',
|
|
305
|
+
[HardwareErrorCode.DeviceCheckPassphraseStateError]: 'Device passphrase state error',
|
|
306
|
+
[HardwareErrorCode.DeviceNotOpenedPassphrase]: 'Device not opened passphrase',
|
|
307
|
+
[HardwareErrorCode.DeviceOpenedPassphrase]: 'Device opened passphrase',
|
|
283
308
|
|
|
284
309
|
/**
|
|
285
310
|
* Node Errors
|
|
@@ -331,6 +356,7 @@ export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
|
|
|
331
356
|
[HardwareErrorCode.BleMonitorError]: 'Monitor Error: characteristic not found',
|
|
332
357
|
[HardwareErrorCode.BleCharacteristicNotifyError]: 'Characteristic Notify Error',
|
|
333
358
|
[HardwareErrorCode.BleWriteCharacteristicError]: 'Write Characteristic Error',
|
|
359
|
+
[HardwareErrorCode.BleAlreadyConnected]: 'Already connected to device',
|
|
334
360
|
|
|
335
361
|
/**
|
|
336
362
|
* Runtime Error
|
|
@@ -346,6 +372,7 @@ export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
|
|
|
346
372
|
[HardwareErrorCode.BridgeNotInstalled]: 'Bridge not installed',
|
|
347
373
|
[HardwareErrorCode.PollingTimeout]: 'Polling timeout',
|
|
348
374
|
[HardwareErrorCode.PollingStop]: 'Polling stop',
|
|
375
|
+
[HardwareErrorCode.BlindSignDisabled]: 'Please confirm the BlindSign enabled',
|
|
349
376
|
} as const;
|
|
350
377
|
|
|
351
378
|
export const TypedError = (
|