@ukeyfe/hd-shared 1.1.19 → 1.1.21
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/constants.d.ts +28 -28
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.d.ts +29 -29
- package/dist/index.js +36 -36
- package/package.json +1 -1
- package/src/HardwareError.ts +2 -2
- package/src/constants.ts +28 -28
package/dist/constants.d.ts
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const UKEY_WEBUSB_FILTER: {
|
|
3
3
|
vendorId: number;
|
|
4
4
|
productId: number;
|
|
5
5
|
}[];
|
|
6
|
-
export declare enum
|
|
7
|
-
BLE_SELECT = "$
|
|
8
|
-
BLE_SELECT_RESULT = "$
|
|
9
|
-
BLE_STOP_SCAN = "$
|
|
10
|
-
BLE_CANCEL_REQUEST = "$
|
|
11
|
-
BLE_PRE_SELECT = "$
|
|
12
|
-
BLE_CLEAR_PRE_SELECT = "$
|
|
13
|
-
BLE_PAIRING_REQUEST = "$
|
|
14
|
-
BLE_PAIRING_RESPONSE = "$
|
|
15
|
-
BLE_ENUMERATE = "$
|
|
16
|
-
BLE_ENUMERATE_RESULT = "$
|
|
17
|
-
BLE_DEVICE_DISCONNECTED = "$
|
|
18
|
-
BLE_AVAILABILITY_CHECK = "$
|
|
19
|
-
NOBLE_BLE_ENUMERATE = "$
|
|
20
|
-
NOBLE_BLE_STOP_SCAN = "$
|
|
21
|
-
NOBLE_BLE_GET_DEVICE = "$
|
|
22
|
-
NOBLE_BLE_CONNECT = "$
|
|
23
|
-
NOBLE_BLE_DISCONNECT = "$
|
|
24
|
-
NOBLE_BLE_WRITE = "$
|
|
25
|
-
NOBLE_BLE_SUBSCRIBE = "$
|
|
26
|
-
NOBLE_BLE_UNSUBSCRIBE = "$
|
|
27
|
-
NOBLE_BLE_NOTIFICATION = "$
|
|
28
|
-
NOBLE_BLE_CANCEL_PAIRING = "$
|
|
6
|
+
export declare enum EUKeyBleMessageKeys {
|
|
7
|
+
BLE_SELECT = "$ukey-ble-select",
|
|
8
|
+
BLE_SELECT_RESULT = "$ukey-ble-select-result",
|
|
9
|
+
BLE_STOP_SCAN = "$ukey-ble-stop-scan",
|
|
10
|
+
BLE_CANCEL_REQUEST = "$ukey-ble-cancel-request",
|
|
11
|
+
BLE_PRE_SELECT = "$ukey-ble-pre-select",
|
|
12
|
+
BLE_CLEAR_PRE_SELECT = "$ukey-ble-clear-pre-select",
|
|
13
|
+
BLE_PAIRING_REQUEST = "$ukey-ble-pairing-request",
|
|
14
|
+
BLE_PAIRING_RESPONSE = "$ukey-ble-pairing-response",
|
|
15
|
+
BLE_ENUMERATE = "$ukey-ble-enumerate",
|
|
16
|
+
BLE_ENUMERATE_RESULT = "$ukey-ble-enumerate-result",
|
|
17
|
+
BLE_DEVICE_DISCONNECTED = "$ukey-ble-device-disconnected",
|
|
18
|
+
BLE_AVAILABILITY_CHECK = "$ukey-ble-availability-check",
|
|
19
|
+
NOBLE_BLE_ENUMERATE = "$ukey-noble-ble-enumerate",
|
|
20
|
+
NOBLE_BLE_STOP_SCAN = "$ukey-noble-ble-stop-scan",
|
|
21
|
+
NOBLE_BLE_GET_DEVICE = "$ukey-noble-ble-get-device",
|
|
22
|
+
NOBLE_BLE_CONNECT = "$ukey-noble-ble-connect",
|
|
23
|
+
NOBLE_BLE_DISCONNECT = "$ukey-noble-ble-disconnect",
|
|
24
|
+
NOBLE_BLE_WRITE = "$ukey-noble-ble-write",
|
|
25
|
+
NOBLE_BLE_SUBSCRIBE = "$ukey-noble-ble-subscribe",
|
|
26
|
+
NOBLE_BLE_UNSUBSCRIBE = "$ukey-noble-ble-unsubscribe",
|
|
27
|
+
NOBLE_BLE_NOTIFICATION = "$ukey-noble-ble-notification",
|
|
28
|
+
NOBLE_BLE_CANCEL_PAIRING = "$ukey-noble-ble-cancel-pairing"
|
|
29
29
|
}
|
|
30
|
-
export declare const
|
|
31
|
-
export declare const
|
|
32
|
-
export declare const
|
|
30
|
+
export declare const UKEY_SERVICE_UUID = "00000001-0000-1000-8000-00805f9b34fb";
|
|
31
|
+
export declare const UKEY_WRITE_CHARACTERISTIC_UUID = "00000002-0000-1000-8000-00805f9b34fb";
|
|
32
|
+
export declare const UKEY_NOTIFY_CHARACTERISTIC_UUID = "00000003-0000-1000-8000-00805f9b34fb";
|
|
33
33
|
export declare const isHeaderChunk: (chunk: Buffer | Uint8Array) => boolean;
|
|
34
|
-
export declare const
|
|
34
|
+
export declare const isUkeyDevice: (name: string | null, id?: string) => boolean;
|
|
35
35
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA,eAAO,MAAM,kBAAkB;;;GAO9B,CAAC;AAGF,oBAAY,mBAAmB;IAE7B,UAAU,qBAAqB;IAC/B,iBAAiB,4BAA4B;IAC7C,aAAa,wBAAwB;IACrC,kBAAkB,6BAA6B;IAC/C,cAAc,yBAAyB;IACvC,oBAAoB,+BAA+B;IAGnD,mBAAmB,8BAA8B;IACjD,oBAAoB,+BAA+B;IAGnD,aAAa,wBAAwB;IACrC,oBAAoB,+BAA+B;IAGnD,uBAAuB,kCAAkC;IACzD,sBAAsB,iCAAiC;IAGvD,mBAAmB,8BAA8B;IACjD,mBAAmB,8BAA8B;IACjD,oBAAoB,+BAA+B;IACnD,iBAAiB,4BAA4B;IAC7C,oBAAoB,+BAA+B;IACnD,eAAe,0BAA0B;IACzC,mBAAmB,8BAA8B;IACjD,qBAAqB,gCAAgC;IACrD,sBAAsB,iCAAiC;IACvD,wBAAwB,mCAAmC;CAC5D;AAED,eAAO,MAAM,iBAAiB,yCAAyC,CAAC;AACxE,eAAO,MAAM,8BAA8B,yCAAyC,CAAC;AACrF,eAAO,MAAM,+BAA+B,yCAAyC,CAAC;AAItF,eAAO,MAAM,aAAa,UAAW,MAAM,GAAG,UAAU,KAAG,OAa1D,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,MAAM,GAAG,IAAI,OAAO,MAAM,KAAG,OAY/D,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const UKEY_WEBUSB_FILTER: {
|
|
2
2
|
vendorId: number;
|
|
3
3
|
productId: number;
|
|
4
4
|
}[];
|
|
5
|
-
declare enum
|
|
6
|
-
BLE_SELECT = "$
|
|
7
|
-
BLE_SELECT_RESULT = "$
|
|
8
|
-
BLE_STOP_SCAN = "$
|
|
9
|
-
BLE_CANCEL_REQUEST = "$
|
|
10
|
-
BLE_PRE_SELECT = "$
|
|
11
|
-
BLE_CLEAR_PRE_SELECT = "$
|
|
12
|
-
BLE_PAIRING_REQUEST = "$
|
|
13
|
-
BLE_PAIRING_RESPONSE = "$
|
|
14
|
-
BLE_ENUMERATE = "$
|
|
15
|
-
BLE_ENUMERATE_RESULT = "$
|
|
16
|
-
BLE_DEVICE_DISCONNECTED = "$
|
|
17
|
-
BLE_AVAILABILITY_CHECK = "$
|
|
18
|
-
NOBLE_BLE_ENUMERATE = "$
|
|
19
|
-
NOBLE_BLE_STOP_SCAN = "$
|
|
20
|
-
NOBLE_BLE_GET_DEVICE = "$
|
|
21
|
-
NOBLE_BLE_CONNECT = "$
|
|
22
|
-
NOBLE_BLE_DISCONNECT = "$
|
|
23
|
-
NOBLE_BLE_WRITE = "$
|
|
24
|
-
NOBLE_BLE_SUBSCRIBE = "$
|
|
25
|
-
NOBLE_BLE_UNSUBSCRIBE = "$
|
|
26
|
-
NOBLE_BLE_NOTIFICATION = "$
|
|
27
|
-
NOBLE_BLE_CANCEL_PAIRING = "$
|
|
5
|
+
declare enum EUKeyBleMessageKeys {
|
|
6
|
+
BLE_SELECT = "$ukey-ble-select",
|
|
7
|
+
BLE_SELECT_RESULT = "$ukey-ble-select-result",
|
|
8
|
+
BLE_STOP_SCAN = "$ukey-ble-stop-scan",
|
|
9
|
+
BLE_CANCEL_REQUEST = "$ukey-ble-cancel-request",
|
|
10
|
+
BLE_PRE_SELECT = "$ukey-ble-pre-select",
|
|
11
|
+
BLE_CLEAR_PRE_SELECT = "$ukey-ble-clear-pre-select",
|
|
12
|
+
BLE_PAIRING_REQUEST = "$ukey-ble-pairing-request",
|
|
13
|
+
BLE_PAIRING_RESPONSE = "$ukey-ble-pairing-response",
|
|
14
|
+
BLE_ENUMERATE = "$ukey-ble-enumerate",
|
|
15
|
+
BLE_ENUMERATE_RESULT = "$ukey-ble-enumerate-result",
|
|
16
|
+
BLE_DEVICE_DISCONNECTED = "$ukey-ble-device-disconnected",
|
|
17
|
+
BLE_AVAILABILITY_CHECK = "$ukey-ble-availability-check",
|
|
18
|
+
NOBLE_BLE_ENUMERATE = "$ukey-noble-ble-enumerate",
|
|
19
|
+
NOBLE_BLE_STOP_SCAN = "$ukey-noble-ble-stop-scan",
|
|
20
|
+
NOBLE_BLE_GET_DEVICE = "$ukey-noble-ble-get-device",
|
|
21
|
+
NOBLE_BLE_CONNECT = "$ukey-noble-ble-connect",
|
|
22
|
+
NOBLE_BLE_DISCONNECT = "$ukey-noble-ble-disconnect",
|
|
23
|
+
NOBLE_BLE_WRITE = "$ukey-noble-ble-write",
|
|
24
|
+
NOBLE_BLE_SUBSCRIBE = "$ukey-noble-ble-subscribe",
|
|
25
|
+
NOBLE_BLE_UNSUBSCRIBE = "$ukey-noble-ble-unsubscribe",
|
|
26
|
+
NOBLE_BLE_NOTIFICATION = "$ukey-noble-ble-notification",
|
|
27
|
+
NOBLE_BLE_CANCEL_PAIRING = "$ukey-noble-ble-cancel-pairing"
|
|
28
28
|
}
|
|
29
|
-
declare const
|
|
30
|
-
declare const
|
|
31
|
-
declare const
|
|
29
|
+
declare const UKEY_SERVICE_UUID = "00000001-0000-1000-8000-00805f9b34fb";
|
|
30
|
+
declare const UKEY_WRITE_CHARACTERISTIC_UUID = "00000002-0000-1000-8000-00805f9b34fb";
|
|
31
|
+
declare const UKEY_NOTIFY_CHARACTERISTIC_UUID = "00000003-0000-1000-8000-00805f9b34fb";
|
|
32
32
|
declare const isHeaderChunk: (chunk: Buffer | Uint8Array) => boolean;
|
|
33
|
-
declare const
|
|
33
|
+
declare const isUkeyDevice: (name: string | null, id?: string) => boolean;
|
|
34
34
|
|
|
35
35
|
type Deferred<T, I = any, D = any> = {
|
|
36
36
|
id?: I;
|
|
@@ -217,4 +217,4 @@ declare enum EFirmwareType {
|
|
|
217
217
|
BitcoinOnly = "bitcoinonly"
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
export { CreateErrorByMessage, CreateHardwareErrorByBridgeError, Deferred, EDeviceType, EFirmwareType,
|
|
220
|
+
export { CreateErrorByMessage, CreateHardwareErrorByBridgeError, Deferred, EDeviceType, EFirmwareType, HardwareError$1 as ERRORS, EUKeyBleMessageKeys, HardwareError, HardwareErrorCode, HardwareErrorCodeMessage, IHardwareError, TypedError, UKEY_NOTIFY_CHARACTERISTIC_UUID, UKEY_SERVICE_UUID, UKEY_WEBUSB_FILTER, UKEY_WRITE_CHARACTERISTIC_UUID, createDefectiveFirmwareError, createDeferred, createDeprecatedHardwareError, createNeedUpgradeFirmwareHardwareError, createNewFirmwareForceUpdateHardwareError, createNewFirmwareUnReleaseHardwareError, isHeaderChunk, isUkeyDevice, serializeError, wait };
|
package/dist/index.js
CHANGED
|
@@ -2,40 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const UKEY_WEBUSB_FILTER = [
|
|
6
6
|
{ vendorId: 0x1209, productId: 0x53c0 },
|
|
7
7
|
{ vendorId: 0x1209, productId: 0x53c1 },
|
|
8
8
|
{ vendorId: 0x1209, productId: 0x4f4a },
|
|
9
9
|
{ vendorId: 0x1209, productId: 0x4f4b },
|
|
10
10
|
];
|
|
11
|
-
exports.
|
|
12
|
-
(function (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
})(exports.
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
11
|
+
exports.EUKeyBleMessageKeys = void 0;
|
|
12
|
+
(function (EUKeyBleMessageKeys) {
|
|
13
|
+
EUKeyBleMessageKeys["BLE_SELECT"] = "$ukey-ble-select";
|
|
14
|
+
EUKeyBleMessageKeys["BLE_SELECT_RESULT"] = "$ukey-ble-select-result";
|
|
15
|
+
EUKeyBleMessageKeys["BLE_STOP_SCAN"] = "$ukey-ble-stop-scan";
|
|
16
|
+
EUKeyBleMessageKeys["BLE_CANCEL_REQUEST"] = "$ukey-ble-cancel-request";
|
|
17
|
+
EUKeyBleMessageKeys["BLE_PRE_SELECT"] = "$ukey-ble-pre-select";
|
|
18
|
+
EUKeyBleMessageKeys["BLE_CLEAR_PRE_SELECT"] = "$ukey-ble-clear-pre-select";
|
|
19
|
+
EUKeyBleMessageKeys["BLE_PAIRING_REQUEST"] = "$ukey-ble-pairing-request";
|
|
20
|
+
EUKeyBleMessageKeys["BLE_PAIRING_RESPONSE"] = "$ukey-ble-pairing-response";
|
|
21
|
+
EUKeyBleMessageKeys["BLE_ENUMERATE"] = "$ukey-ble-enumerate";
|
|
22
|
+
EUKeyBleMessageKeys["BLE_ENUMERATE_RESULT"] = "$ukey-ble-enumerate-result";
|
|
23
|
+
EUKeyBleMessageKeys["BLE_DEVICE_DISCONNECTED"] = "$ukey-ble-device-disconnected";
|
|
24
|
+
EUKeyBleMessageKeys["BLE_AVAILABILITY_CHECK"] = "$ukey-ble-availability-check";
|
|
25
|
+
EUKeyBleMessageKeys["NOBLE_BLE_ENUMERATE"] = "$ukey-noble-ble-enumerate";
|
|
26
|
+
EUKeyBleMessageKeys["NOBLE_BLE_STOP_SCAN"] = "$ukey-noble-ble-stop-scan";
|
|
27
|
+
EUKeyBleMessageKeys["NOBLE_BLE_GET_DEVICE"] = "$ukey-noble-ble-get-device";
|
|
28
|
+
EUKeyBleMessageKeys["NOBLE_BLE_CONNECT"] = "$ukey-noble-ble-connect";
|
|
29
|
+
EUKeyBleMessageKeys["NOBLE_BLE_DISCONNECT"] = "$ukey-noble-ble-disconnect";
|
|
30
|
+
EUKeyBleMessageKeys["NOBLE_BLE_WRITE"] = "$ukey-noble-ble-write";
|
|
31
|
+
EUKeyBleMessageKeys["NOBLE_BLE_SUBSCRIBE"] = "$ukey-noble-ble-subscribe";
|
|
32
|
+
EUKeyBleMessageKeys["NOBLE_BLE_UNSUBSCRIBE"] = "$ukey-noble-ble-unsubscribe";
|
|
33
|
+
EUKeyBleMessageKeys["NOBLE_BLE_NOTIFICATION"] = "$ukey-noble-ble-notification";
|
|
34
|
+
EUKeyBleMessageKeys["NOBLE_BLE_CANCEL_PAIRING"] = "$ukey-noble-ble-cancel-pairing";
|
|
35
|
+
})(exports.EUKeyBleMessageKeys || (exports.EUKeyBleMessageKeys = {}));
|
|
36
|
+
const UKEY_SERVICE_UUID = '00000001-0000-1000-8000-00805f9b34fb';
|
|
37
|
+
const UKEY_WRITE_CHARACTERISTIC_UUID = '00000002-0000-1000-8000-00805f9b34fb';
|
|
38
|
+
const UKEY_NOTIFY_CHARACTERISTIC_UUID = '00000003-0000-1000-8000-00805f9b34fb';
|
|
39
39
|
const MESSAGE_TOP_CHAR = 63;
|
|
40
40
|
const MESSAGE_HEADER_BYTE = 35;
|
|
41
41
|
const isHeaderChunk = (chunk) => {
|
|
@@ -49,7 +49,7 @@ const isHeaderChunk = (chunk) => {
|
|
|
49
49
|
}
|
|
50
50
|
return false;
|
|
51
51
|
};
|
|
52
|
-
const
|
|
52
|
+
const isUkeyDevice = (name, id) => {
|
|
53
53
|
var _a;
|
|
54
54
|
if ((_a = id === null || id === void 0 ? void 0 : id.startsWith) === null || _a === void 0 ? void 0 : _a.call(id, 'MI')) {
|
|
55
55
|
return true;
|
|
@@ -309,7 +309,7 @@ const HardwareErrorCodeMessage = {
|
|
|
309
309
|
[HardwareErrorCode.FirmwareUpdateAutoEnterBootFailure]: 'Description Failed to automatically enter boot',
|
|
310
310
|
[HardwareErrorCode.NewFirmwareUnRelease]: 'new firmware has not been released yet',
|
|
311
311
|
[HardwareErrorCode.NewFirmwareForceUpdate]: 'new firmware has been released, please update',
|
|
312
|
-
[HardwareErrorCode.UseDesktopToUpdateFirmware]: 'Please use
|
|
312
|
+
[HardwareErrorCode.UseDesktopToUpdateFirmware]: 'Please use UKEY desktop client to update the firmware',
|
|
313
313
|
[HardwareErrorCode.DeviceNotSupportMethod]: 'Device not support this method',
|
|
314
314
|
[HardwareErrorCode.ForbiddenKeyPath]: 'Forbidden key path',
|
|
315
315
|
[HardwareErrorCode.RepeatUnlocking]: 'Repeat unlocking',
|
|
@@ -492,11 +492,11 @@ exports.ERRORS = HardwareError$1;
|
|
|
492
492
|
exports.HardwareError = HardwareError;
|
|
493
493
|
exports.HardwareErrorCode = HardwareErrorCode;
|
|
494
494
|
exports.HardwareErrorCodeMessage = HardwareErrorCodeMessage;
|
|
495
|
-
exports.ONEKEY_NOTIFY_CHARACTERISTIC_UUID = ONEKEY_NOTIFY_CHARACTERISTIC_UUID;
|
|
496
|
-
exports.ONEKEY_SERVICE_UUID = ONEKEY_SERVICE_UUID;
|
|
497
|
-
exports.ONEKEY_WEBUSB_FILTER = ONEKEY_WEBUSB_FILTER;
|
|
498
|
-
exports.ONEKEY_WRITE_CHARACTERISTIC_UUID = ONEKEY_WRITE_CHARACTERISTIC_UUID;
|
|
499
495
|
exports.TypedError = TypedError;
|
|
496
|
+
exports.UKEY_NOTIFY_CHARACTERISTIC_UUID = UKEY_NOTIFY_CHARACTERISTIC_UUID;
|
|
497
|
+
exports.UKEY_SERVICE_UUID = UKEY_SERVICE_UUID;
|
|
498
|
+
exports.UKEY_WEBUSB_FILTER = UKEY_WEBUSB_FILTER;
|
|
499
|
+
exports.UKEY_WRITE_CHARACTERISTIC_UUID = UKEY_WRITE_CHARACTERISTIC_UUID;
|
|
500
500
|
exports.createDefectiveFirmwareError = createDefectiveFirmwareError;
|
|
501
501
|
exports.createDeferred = createDeferred;
|
|
502
502
|
exports.createDeprecatedHardwareError = createDeprecatedHardwareError;
|
|
@@ -504,6 +504,6 @@ exports.createNeedUpgradeFirmwareHardwareError = createNeedUpgradeFirmwareHardwa
|
|
|
504
504
|
exports.createNewFirmwareForceUpdateHardwareError = createNewFirmwareForceUpdateHardwareError;
|
|
505
505
|
exports.createNewFirmwareUnReleaseHardwareError = createNewFirmwareUnReleaseHardwareError;
|
|
506
506
|
exports.isHeaderChunk = isHeaderChunk;
|
|
507
|
-
exports.
|
|
507
|
+
exports.isUkeyDevice = isUkeyDevice;
|
|
508
508
|
exports.serializeError = serializeError;
|
|
509
509
|
exports.wait = wait;
|
package/package.json
CHANGED
package/src/HardwareError.ts
CHANGED
|
@@ -260,7 +260,7 @@ export const HardwareErrorCode = {
|
|
|
260
260
|
NewFirmwareUnRelease: 412,
|
|
261
261
|
|
|
262
262
|
/**
|
|
263
|
-
* use
|
|
263
|
+
* use UKEY desktop client to update the firmware
|
|
264
264
|
* because need copy resource file to Touch
|
|
265
265
|
*/
|
|
266
266
|
UseDesktopToUpdateFirmware: 413,
|
|
@@ -523,7 +523,7 @@ export const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping = {
|
|
|
523
523
|
[HardwareErrorCode.NewFirmwareUnRelease]: 'new firmware has not been released yet',
|
|
524
524
|
[HardwareErrorCode.NewFirmwareForceUpdate]: 'new firmware has been released, please update',
|
|
525
525
|
[HardwareErrorCode.UseDesktopToUpdateFirmware]:
|
|
526
|
-
'Please use
|
|
526
|
+
'Please use UKEY desktop client to update the firmware',
|
|
527
527
|
[HardwareErrorCode.DeviceNotSupportMethod]: 'Device not support this method',
|
|
528
528
|
[HardwareErrorCode.ForbiddenKeyPath]: 'Forbidden key path',
|
|
529
529
|
[HardwareErrorCode.RepeatUnlocking]: 'Repeat unlocking',
|
package/src/constants.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const UKEY_WEBUSB_FILTER = [
|
|
2
2
|
{ vendorId: 0x1209, productId: 0x53c0 }, // Classic Boot、Classic1s Boot、Mini Boot
|
|
3
3
|
{ vendorId: 0x1209, productId: 0x53c1 }, // Classic Firmware、Classic1s Firmware、Mini Firmware、Pro Firmware、Touch Firmware
|
|
4
4
|
{ vendorId: 0x1209, productId: 0x4f4a }, // Pro Boot、Touch Boot
|
|
@@ -8,43 +8,43 @@ export const ONEKEY_WEBUSB_FILTER = [
|
|
|
8
8
|
];
|
|
9
9
|
|
|
10
10
|
// BLE IPC communication message types
|
|
11
|
-
export enum
|
|
11
|
+
export enum EUKeyBleMessageKeys {
|
|
12
12
|
// BLE device selection related
|
|
13
|
-
BLE_SELECT = '$
|
|
14
|
-
BLE_SELECT_RESULT = '$
|
|
15
|
-
BLE_STOP_SCAN = '$
|
|
16
|
-
BLE_CANCEL_REQUEST = '$
|
|
17
|
-
BLE_PRE_SELECT = '$
|
|
18
|
-
BLE_CLEAR_PRE_SELECT = '$
|
|
13
|
+
BLE_SELECT = '$ukey-ble-select',
|
|
14
|
+
BLE_SELECT_RESULT = '$ukey-ble-select-result',
|
|
15
|
+
BLE_STOP_SCAN = '$ukey-ble-stop-scan',
|
|
16
|
+
BLE_CANCEL_REQUEST = '$ukey-ble-cancel-request',
|
|
17
|
+
BLE_PRE_SELECT = '$ukey-ble-pre-select',
|
|
18
|
+
BLE_CLEAR_PRE_SELECT = '$ukey-ble-clear-pre-select',
|
|
19
19
|
|
|
20
20
|
// BLE pairing related
|
|
21
|
-
BLE_PAIRING_REQUEST = '$
|
|
22
|
-
BLE_PAIRING_RESPONSE = '$
|
|
21
|
+
BLE_PAIRING_REQUEST = '$ukey-ble-pairing-request',
|
|
22
|
+
BLE_PAIRING_RESPONSE = '$ukey-ble-pairing-response',
|
|
23
23
|
|
|
24
24
|
// BLE enumeration related
|
|
25
|
-
BLE_ENUMERATE = '$
|
|
26
|
-
BLE_ENUMERATE_RESULT = '$
|
|
25
|
+
BLE_ENUMERATE = '$ukey-ble-enumerate',
|
|
26
|
+
BLE_ENUMERATE_RESULT = '$ukey-ble-enumerate-result',
|
|
27
27
|
|
|
28
28
|
// BLE connection status related
|
|
29
|
-
BLE_DEVICE_DISCONNECTED = '$
|
|
30
|
-
BLE_AVAILABILITY_CHECK = '$
|
|
29
|
+
BLE_DEVICE_DISCONNECTED = '$ukey-ble-device-disconnected',
|
|
30
|
+
BLE_AVAILABILITY_CHECK = '$ukey-ble-availability-check',
|
|
31
31
|
|
|
32
32
|
// Noble BLE related (for direct BLE communication)
|
|
33
|
-
NOBLE_BLE_ENUMERATE = '$
|
|
34
|
-
NOBLE_BLE_STOP_SCAN = '$
|
|
35
|
-
NOBLE_BLE_GET_DEVICE = '$
|
|
36
|
-
NOBLE_BLE_CONNECT = '$
|
|
37
|
-
NOBLE_BLE_DISCONNECT = '$
|
|
38
|
-
NOBLE_BLE_WRITE = '$
|
|
39
|
-
NOBLE_BLE_SUBSCRIBE = '$
|
|
40
|
-
NOBLE_BLE_UNSUBSCRIBE = '$
|
|
41
|
-
NOBLE_BLE_NOTIFICATION = '$
|
|
42
|
-
NOBLE_BLE_CANCEL_PAIRING = '$
|
|
33
|
+
NOBLE_BLE_ENUMERATE = '$ukey-noble-ble-enumerate',
|
|
34
|
+
NOBLE_BLE_STOP_SCAN = '$ukey-noble-ble-stop-scan',
|
|
35
|
+
NOBLE_BLE_GET_DEVICE = '$ukey-noble-ble-get-device',
|
|
36
|
+
NOBLE_BLE_CONNECT = '$ukey-noble-ble-connect',
|
|
37
|
+
NOBLE_BLE_DISCONNECT = '$ukey-noble-ble-disconnect',
|
|
38
|
+
NOBLE_BLE_WRITE = '$ukey-noble-ble-write',
|
|
39
|
+
NOBLE_BLE_SUBSCRIBE = '$ukey-noble-ble-subscribe',
|
|
40
|
+
NOBLE_BLE_UNSUBSCRIBE = '$ukey-noble-ble-unsubscribe',
|
|
41
|
+
NOBLE_BLE_NOTIFICATION = '$ukey-noble-ble-notification',
|
|
42
|
+
NOBLE_BLE_CANCEL_PAIRING = '$ukey-noble-ble-cancel-pairing',
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export const
|
|
46
|
-
export const
|
|
47
|
-
export const
|
|
45
|
+
export const UKEY_SERVICE_UUID = '00000001-0000-1000-8000-00805f9b34fb';
|
|
46
|
+
export const UKEY_WRITE_CHARACTERISTIC_UUID = '00000002-0000-1000-8000-00805f9b34fb';
|
|
47
|
+
export const UKEY_NOTIFY_CHARACTERISTIC_UUID = '00000003-0000-1000-8000-00805f9b34fb';
|
|
48
48
|
|
|
49
49
|
const MESSAGE_TOP_CHAR = 63;
|
|
50
50
|
const MESSAGE_HEADER_BYTE = 35;
|
|
@@ -63,7 +63,7 @@ export const isHeaderChunk = (chunk: Buffer | Uint8Array): boolean => {
|
|
|
63
63
|
return false;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
export const
|
|
66
|
+
export const isUkeyDevice = (name: string | null, id?: string): boolean => {
|
|
67
67
|
if (id?.startsWith?.('MI')) {
|
|
68
68
|
return true;
|
|
69
69
|
}
|