@onekeyfe/hd-core 1.0.22-alpha.3 → 1.0.22
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/api/CheckFirmwareRelease.d.ts +2 -2
- package/dist/api/{RequestWebUsbDevice.d.ts → PromptWebDeviceAccess.d.ts} +2 -2
- package/dist/api/PromptWebDeviceAccess.d.ts.map +1 -0
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/index.d.ts +1 -7
- package/dist/api/index.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +1 -0
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/device/DeviceConnector.d.ts +3 -0
- package/dist/device/DeviceConnector.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +2 -1
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/index.d.ts +12 -25
- package/dist/index.js +52 -145
- package/dist/inject.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +2 -14
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/promptWebDeviceAccess.d.ts +8 -0
- package/dist/types/api/promptWebDeviceAccess.d.ts.map +1 -0
- package/dist/types/device.d.ts +1 -1
- package/dist/types/device.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +6 -4
- package/src/api/PromptWebDeviceAccess.ts +75 -0
- package/src/api/SearchDevices.ts +0 -1
- package/src/api/index.ts +1 -8
- package/src/core/index.ts +6 -0
- package/src/data/messages/messages.json +2 -13
- package/src/data-manager/DataManager.ts +2 -5
- package/src/device/DeviceConnector.ts +7 -0
- package/src/events/ui-request.ts +4 -1
- package/src/inject.ts +1 -13
- package/src/types/api/index.ts +2 -16
- package/src/types/api/promptWebDeviceAccess.ts +6 -0
- package/src/types/device.ts +5 -13
- package/src/utils/deviceInfoUtils.ts +0 -3
- package/tsconfig.json +4 -0
- package/dist/api/RequestWebUsbDevice.d.ts.map +0 -1
- package/dist/api/device/DeviceInfoSettings.d.ts +0 -7
- package/dist/api/device/DeviceInfoSettings.d.ts.map +0 -1
- package/dist/api/device/DeviceReadSEPublicCert.d.ts +0 -7
- package/dist/api/device/DeviceReadSEPublicCert.d.ts.map +0 -1
- package/dist/api/device/DeviceSESignMessage.d.ts +0 -7
- package/dist/api/device/DeviceSESignMessage.d.ts.map +0 -1
- package/dist/api/device/DeviceWriteSEPrivateKey.d.ts +0 -7
- package/dist/api/device/DeviceWriteSEPrivateKey.d.ts.map +0 -1
- package/dist/api/device/DeviceWriteSEPublicCert.d.ts +0 -7
- package/dist/api/device/DeviceWriteSEPublicCert.d.ts.map +0 -1
- package/dist/api/device/GetDeviceInfoSettings.d.ts +0 -7
- package/dist/api/device/GetDeviceInfoSettings.d.ts.map +0 -1
- package/dist/types/api/deviceGetInfo.d.ts +0 -4
- package/dist/types/api/deviceGetInfo.d.ts.map +0 -1
- package/dist/types/api/deviceInfoSettings.d.ts +0 -4
- package/dist/types/api/deviceInfoSettings.d.ts.map +0 -1
- package/dist/types/api/deviceReadSEPublicCert.d.ts +0 -4
- package/dist/types/api/deviceReadSEPublicCert.d.ts.map +0 -1
- package/dist/types/api/deviceSESignMessage.d.ts +0 -4
- package/dist/types/api/deviceSESignMessage.d.ts.map +0 -1
- package/dist/types/api/deviceWriteSEPrivateKey.d.ts +0 -4
- package/dist/types/api/deviceWriteSEPrivateKey.d.ts.map +0 -1
- package/dist/types/api/deviceWriteSEPublicCert.d.ts +0 -4
- package/dist/types/api/deviceWriteSEPublicCert.d.ts.map +0 -1
- package/dist/types/api/requestWebUsbDevice.d.ts +0 -6
- package/dist/types/api/requestWebUsbDevice.d.ts.map +0 -1
- package/src/api/RequestWebUsbDevice.ts +0 -48
- package/src/api/device/DeviceInfoSettings.ts +0 -22
- package/src/api/device/DeviceReadSEPublicCert.ts +0 -17
- package/src/api/device/DeviceSESignMessage.ts +0 -22
- package/src/api/device/DeviceWriteSEPrivateKey.ts +0 -22
- package/src/api/device/DeviceWriteSEPublicCert.ts +0 -22
- package/src/api/device/GetDeviceInfoSettings.ts +0 -19
- package/src/types/api/deviceGetInfo.ts +0 -7
- package/src/types/api/deviceInfoSettings.ts +0 -7
- package/src/types/api/deviceReadSEPublicCert.ts +0 -7
- package/src/types/api/deviceSESignMessage.ts +0 -7
- package/src/types/api/deviceWriteSEPrivateKey.ts +0 -7
- package/src/types/api/deviceWriteSEPublicCert.ts +0 -7
- package/src/types/api/requestWebUsbDevice.ts +0 -4
package/src/types/device.ts
CHANGED
|
@@ -79,32 +79,24 @@ export type Features = PROTO.Features;
|
|
|
79
79
|
|
|
80
80
|
export type OnekeyFeatures = PROTO.OnekeyFeatures;
|
|
81
81
|
|
|
82
|
-
export type IDeviceType =
|
|
83
|
-
| 'unknown'
|
|
84
|
-
| 'classic'
|
|
85
|
-
| 'classic1s'
|
|
86
|
-
| 'classicPure'
|
|
87
|
-
| 'mini'
|
|
88
|
-
| 'touch'
|
|
89
|
-
| 'pro';
|
|
82
|
+
export type IDeviceType = 'unknown' | 'classic' | 'classic1s' | 'mini' | 'touch' | 'pro';
|
|
90
83
|
|
|
91
84
|
/**
|
|
92
|
-
* model_classic: 'classic' | 'classic1s'
|
|
93
|
-
* model_mini: 'classic' | '
|
|
85
|
+
* model_classic: 'classic' | 'classic1s'
|
|
86
|
+
* model_mini: 'classic' | 'mini'
|
|
94
87
|
* model_touch: 'touch' | 'pro'
|
|
95
88
|
*/
|
|
96
89
|
export type IDeviceModel = 'model_classic' | 'model_mini' | 'model_touch';
|
|
97
90
|
|
|
98
91
|
export const DeviceModelToTypes: { [deviceModel in IDeviceModel]: IDeviceType[] } = {
|
|
99
|
-
model_mini: ['classic', 'classic1s', '
|
|
92
|
+
model_mini: ['classic', 'classic1s', 'mini'],
|
|
100
93
|
model_touch: ['touch', 'pro'],
|
|
101
|
-
model_classic: ['classic', 'classic1s'
|
|
94
|
+
model_classic: ['classic', 'classic1s'],
|
|
102
95
|
};
|
|
103
96
|
|
|
104
97
|
export const DeviceTypeToModels: { [deviceType in IDeviceType]: IDeviceModel[] } = {
|
|
105
98
|
classic: ['model_classic', 'model_mini'],
|
|
106
99
|
classic1s: ['model_classic', 'model_mini'],
|
|
107
|
-
classicPure: ['model_classic', 'model_mini'],
|
|
108
100
|
mini: ['model_mini'],
|
|
109
101
|
touch: ['model_touch'],
|
|
110
102
|
pro: ['model_touch'],
|
|
@@ -23,8 +23,6 @@ export const getDeviceType = (features?: Features): IDeviceType => {
|
|
|
23
23
|
return 'touch';
|
|
24
24
|
case 'PRO':
|
|
25
25
|
return 'pro';
|
|
26
|
-
case 'PURE':
|
|
27
|
-
return 'classicPure';
|
|
28
26
|
default:
|
|
29
27
|
// future And old device onekey_device_type is empty
|
|
30
28
|
if (!isEmpty(features.onekey_serial_no)) {
|
|
@@ -48,7 +46,6 @@ export const getDeviceType = (features?: Features): IDeviceType => {
|
|
|
48
46
|
// By May 2021, the miniFlag is 'bixin' for all classic devices
|
|
49
47
|
if (miniFlag.toLowerCase() === 'bi') return 'classic';
|
|
50
48
|
if (miniFlag.toLowerCase() === 'cl') return 'classic';
|
|
51
|
-
if (miniFlag.toLowerCase() === 'cp') return 'classicPure';
|
|
52
49
|
if (miniFlag.toLowerCase() === 'mi') return 'mini';
|
|
53
50
|
if (miniFlag.toLowerCase() === 'tc') return 'touch';
|
|
54
51
|
if (miniFlag.toLowerCase() === 'pr') return 'pro';
|
package/tsconfig.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RequestWebUsbDevice.d.ts","sourceRoot":"","sources":["../../src/api/RequestWebUsbDevice.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,UAAU;IACzD,IAAI;IAME,GAAG;;;CA+BV"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DeviceInfoSettings as HardwareDeviceInfoSettings } from '@onekeyfe/hd-transport';
|
|
2
|
-
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
export default class DeviceInfoSettings extends BaseMethod<HardwareDeviceInfoSettings> {
|
|
4
|
-
init(): void;
|
|
5
|
-
run(): Promise<import("@onekeyfe/hd-transport").Success>;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=DeviceInfoSettings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceInfoSettings.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceInfoSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU,CAAC,0BAA0B,CAAC;IACpF,IAAI;IAWE,GAAG;CAKV"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ReadSEPublicCert } from '@onekeyfe/hd-transport';
|
|
2
|
-
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
export default class DeviceReadSEPublicCert extends BaseMethod<ReadSEPublicCert> {
|
|
4
|
-
init(): void;
|
|
5
|
-
run(): Promise<import("@onekeyfe/hd-transport").SEPublicCert>;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=DeviceReadSEPublicCert.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceReadSEPublicCert.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceReadSEPublicCert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,UAAU,CAAC,gBAAgB,CAAC;IAC9E,IAAI;IAME,GAAG;CAKV"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SESignMessage } from '@onekeyfe/hd-transport';
|
|
2
|
-
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
export default class DeviceSESignMessage extends BaseMethod<SESignMessage> {
|
|
4
|
-
init(): void;
|
|
5
|
-
run(): Promise<import("@onekeyfe/hd-transport").SEMessageSignature>;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=DeviceSESignMessage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceSESignMessage.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceSESignMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,UAAU,CAAC,aAAa,CAAC;IACxE,IAAI;IASE,GAAG;CAOV"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { WriteSEPrivateKey } from '@onekeyfe/hd-transport';
|
|
2
|
-
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
export default class DeviceWriteSEPrivateKey extends BaseMethod<WriteSEPrivateKey> {
|
|
4
|
-
init(): void;
|
|
5
|
-
run(): Promise<import("@onekeyfe/hd-transport").Success>;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=DeviceWriteSEPrivateKey.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceWriteSEPrivateKey.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceWriteSEPrivateKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IAChF,IAAI;IASE,GAAG;CAOV"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { WriteSEPublicCert } from '@onekeyfe/hd-transport';
|
|
2
|
-
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
export default class DeviceWriteSEPublicCert extends BaseMethod<WriteSEPublicCert> {
|
|
4
|
-
init(): void;
|
|
5
|
-
run(): Promise<import("@onekeyfe/hd-transport").Success>;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=DeviceWriteSEPublicCert.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceWriteSEPublicCert.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceWriteSEPublicCert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IAChF,IAAI;IASE,GAAG;CAOV"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { GetDeviceInfo } from '@onekeyfe/hd-transport';
|
|
2
|
-
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
export default class GetDeviceInfoSettings extends BaseMethod<GetDeviceInfo> {
|
|
4
|
-
init(): void;
|
|
5
|
-
run(): Promise<import("@onekeyfe/hd-transport").DeviceInfo>;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=GetDeviceInfoSettings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GetDeviceInfoSettings.d.ts","sourceRoot":"","sources":["../../../src/api/device/GetDeviceInfoSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,UAAU,CAAC,aAAa,CAAC;IAC1E,IAAI;IAQE,GAAG;CAKV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deviceGetInfo.d.ts","sourceRoot":"","sources":["../../../src/types/api/deviceGetInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,YAAY,GACpB,QAAQ,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { DeviceInfoSettings, Success } from '@onekeyfe/hd-transport';
|
|
2
|
-
import type { CommonParams, Response } from '../params';
|
|
3
|
-
export declare function deviceInfoSettings(connectId: string, params: CommonParams & DeviceInfoSettings): Response<Success>;
|
|
4
|
-
//# sourceMappingURL=deviceInfoSettings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deviceInfoSettings.d.ts","sourceRoot":"","sources":["../../../src/types/api/deviceInfoSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,kBAAkB,GACxC,QAAQ,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { SEPublicCert } from '@onekeyfe/hd-transport';
|
|
2
|
-
import type { CommonParams, Response } from '../params';
|
|
3
|
-
export declare function deviceReadSEPublicCert(connectId: string, params?: CommonParams): Response<SEPublicCert>;
|
|
4
|
-
//# sourceMappingURL=deviceReadSEPublicCert.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deviceReadSEPublicCert.d.ts","sourceRoot":"","sources":["../../../src/types/api/deviceReadSEPublicCert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,YAAY,GACpB,QAAQ,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { SESignMessage, SEMessageSignature } from '@onekeyfe/hd-transport';
|
|
2
|
-
import type { CommonParams, Response } from '../params';
|
|
3
|
-
export declare function deviceSESignMessage(connectId: string, params: CommonParams & SESignMessage): Response<SEMessageSignature>;
|
|
4
|
-
//# sourceMappingURL=deviceSESignMessage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deviceSESignMessage.d.ts","sourceRoot":"","sources":["../../../src/types/api/deviceSESignMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,aAAa,GACnC,QAAQ,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Success, WriteSEPrivateKey } from '@onekeyfe/hd-transport';
|
|
2
|
-
import type { CommonParams, Response } from '../params';
|
|
3
|
-
export declare function deviceWriteSEPrivateKey(connectId: string, params: CommonParams & WriteSEPrivateKey): Response<Success>;
|
|
4
|
-
//# sourceMappingURL=deviceWriteSEPrivateKey.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deviceWriteSEPrivateKey.d.ts","sourceRoot":"","sources":["../../../src/types/api/deviceWriteSEPrivateKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,iBAAiB,GACvC,QAAQ,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Success, WriteSEPublicCert } from '@onekeyfe/hd-transport';
|
|
2
|
-
import type { CommonParams, Response } from '../params';
|
|
3
|
-
export declare function deviceWriteSEPublicCert(connectId: string, params: CommonParams & WriteSEPublicCert): Response<Success>;
|
|
4
|
-
//# sourceMappingURL=deviceWriteSEPublicCert.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deviceWriteSEPublicCert.d.ts","sourceRoot":"","sources":["../../../src/types/api/deviceWriteSEPublicCert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,iBAAiB,GACvC,QAAQ,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"requestWebUsbDevice.d.ts","sourceRoot":"","sources":["../../../src/types/api/requestWebUsbDevice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,CAAC,OAAO,UAAU,mBAAmB,IAAI,QAAQ,CAAC;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,CAAC,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
2
|
-
import { BaseMethod } from './BaseMethod';
|
|
3
|
-
import TransportManager from '../data-manager/TransportManager';
|
|
4
|
-
import { DataManager } from '../data-manager';
|
|
5
|
-
import { DevicePool } from '../device/DevicePool';
|
|
6
|
-
import { getLogger, LoggerNames } from '../utils';
|
|
7
|
-
|
|
8
|
-
const Log = getLogger(LoggerNames.Method);
|
|
9
|
-
|
|
10
|
-
export default class RequestWebUsbDevice extends BaseMethod {
|
|
11
|
-
init() {
|
|
12
|
-
this.useDevice = false;
|
|
13
|
-
this.useDevicePassphraseState = false;
|
|
14
|
-
this.skipForceUpdateCheck = true;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async run() {
|
|
18
|
-
await TransportManager.configure();
|
|
19
|
-
|
|
20
|
-
const env = DataManager.getSettings('env');
|
|
21
|
-
if (env !== 'webusb') {
|
|
22
|
-
return Promise.reject(
|
|
23
|
-
ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'Not webusb environment')
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
const deviceDiff = await this.connector?.enumerate();
|
|
29
|
-
const devicesDescriptor = deviceDiff?.descriptors ?? [];
|
|
30
|
-
const { deviceList } = await DevicePool.getDevices(devicesDescriptor);
|
|
31
|
-
/**
|
|
32
|
-
* get first onekey device
|
|
33
|
-
*/
|
|
34
|
-
if (deviceList.length > 0) {
|
|
35
|
-
return { device: deviceList[0].toMessageObject() };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return await Promise.reject(
|
|
39
|
-
ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'Please select the device to connect')
|
|
40
|
-
);
|
|
41
|
-
} catch (error) {
|
|
42
|
-
Log.debug(error);
|
|
43
|
-
return Promise.reject(
|
|
44
|
-
ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'Please select the device to connect')
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { DeviceInfoSettings as HardwareDeviceInfoSettings } from '@onekeyfe/hd-transport';
|
|
2
|
-
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
import { UI_REQUEST } from '../../constants/ui-request';
|
|
4
|
-
|
|
5
|
-
export default class DeviceInfoSettings extends BaseMethod<HardwareDeviceInfoSettings> {
|
|
6
|
-
init() {
|
|
7
|
-
this.useDevicePassphraseState = false;
|
|
8
|
-
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.BOOTLOADER];
|
|
9
|
-
this.skipForceUpdateCheck = true;
|
|
10
|
-
this.params = {
|
|
11
|
-
serial_no: this.payload.serial_no,
|
|
12
|
-
cpu_info: this.payload.cpu_info,
|
|
13
|
-
pre_firmware: this.payload.pre_firmware,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async run() {
|
|
18
|
-
const res = await this.device.commands.typedCall('DeviceInfoSettings', 'Success', this.params);
|
|
19
|
-
|
|
20
|
-
return Promise.resolve(res.message);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ReadSEPublicCert } from '@onekeyfe/hd-transport';
|
|
2
|
-
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
import { UI_REQUEST } from '../../constants/ui-request';
|
|
4
|
-
|
|
5
|
-
export default class DeviceReadSEPublicCert extends BaseMethod<ReadSEPublicCert> {
|
|
6
|
-
init() {
|
|
7
|
-
this.useDevicePassphraseState = false;
|
|
8
|
-
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.BOOTLOADER];
|
|
9
|
-
this.skipForceUpdateCheck = true;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async run() {
|
|
13
|
-
const res = await this.device.commands.typedCall('ReadSEPublicCert', 'SEPublicCert');
|
|
14
|
-
|
|
15
|
-
return Promise.resolve(res.message);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { SESignMessage } from '@onekeyfe/hd-transport';
|
|
2
|
-
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
import { UI_REQUEST } from '../../constants/ui-request';
|
|
4
|
-
|
|
5
|
-
export default class DeviceSESignMessage extends BaseMethod<SESignMessage> {
|
|
6
|
-
init() {
|
|
7
|
-
this.useDevicePassphraseState = false;
|
|
8
|
-
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.BOOTLOADER];
|
|
9
|
-
this.params = {
|
|
10
|
-
message: this.payload.message,
|
|
11
|
-
};
|
|
12
|
-
this.skipForceUpdateCheck = true;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async run() {
|
|
16
|
-
const res = await this.device.commands.typedCall('SESignMessage', 'SEMessageSignature', {
|
|
17
|
-
...this.params,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
return Promise.resolve(res.message);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { WriteSEPrivateKey } from '@onekeyfe/hd-transport';
|
|
2
|
-
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
import { UI_REQUEST } from '../../constants/ui-request';
|
|
4
|
-
|
|
5
|
-
export default class DeviceWriteSEPrivateKey extends BaseMethod<WriteSEPrivateKey> {
|
|
6
|
-
init() {
|
|
7
|
-
this.useDevicePassphraseState = false;
|
|
8
|
-
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.BOOTLOADER];
|
|
9
|
-
this.params = {
|
|
10
|
-
private_key: this.payload.private_key,
|
|
11
|
-
};
|
|
12
|
-
this.skipForceUpdateCheck = true;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async run() {
|
|
16
|
-
const res = await this.device.commands.typedCall('WriteSEPrivateKey', 'Success', {
|
|
17
|
-
...this.params,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
return Promise.resolve(res.message);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { WriteSEPublicCert } from '@onekeyfe/hd-transport';
|
|
2
|
-
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
import { UI_REQUEST } from '../../constants/ui-request';
|
|
4
|
-
|
|
5
|
-
export default class DeviceWriteSEPublicCert extends BaseMethod<WriteSEPublicCert> {
|
|
6
|
-
init() {
|
|
7
|
-
this.useDevicePassphraseState = false;
|
|
8
|
-
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.BOOTLOADER];
|
|
9
|
-
this.params = {
|
|
10
|
-
public_cert: this.payload.public_cert,
|
|
11
|
-
};
|
|
12
|
-
this.skipForceUpdateCheck = true;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async run() {
|
|
16
|
-
const res = await this.device.commands.typedCall('WriteSEPublicCert', 'Success', {
|
|
17
|
-
...this.params,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
return Promise.resolve(res.message);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { GetDeviceInfo } from '@onekeyfe/hd-transport';
|
|
2
|
-
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
import { UI_REQUEST } from '../../constants/ui-request';
|
|
4
|
-
|
|
5
|
-
export default class GetDeviceInfoSettings extends BaseMethod<GetDeviceInfo> {
|
|
6
|
-
init() {
|
|
7
|
-
this.useDevicePassphraseState = false;
|
|
8
|
-
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.BOOTLOADER];
|
|
9
|
-
this.skipForceUpdateCheck = true;
|
|
10
|
-
|
|
11
|
-
this.params = {};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async run() {
|
|
15
|
-
const res = await this.device.commands.typedCall('GetDeviceInfo', 'DeviceInfo');
|
|
16
|
-
|
|
17
|
-
return Promise.resolve(res.message);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SESignMessage, SEMessageSignature } from '@onekeyfe/hd-transport';
|
|
2
|
-
import type { CommonParams, Response } from '../params';
|
|
3
|
-
|
|
4
|
-
export declare function deviceSESignMessage(
|
|
5
|
-
connectId: string,
|
|
6
|
-
params: CommonParams & SESignMessage
|
|
7
|
-
): Response<SEMessageSignature>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Success, WriteSEPrivateKey } from '@onekeyfe/hd-transport';
|
|
2
|
-
import type { CommonParams, Response } from '../params';
|
|
3
|
-
|
|
4
|
-
export declare function deviceWriteSEPrivateKey(
|
|
5
|
-
connectId: string,
|
|
6
|
-
params: CommonParams & WriteSEPrivateKey
|
|
7
|
-
): Response<Success>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Success, WriteSEPublicCert } from '@onekeyfe/hd-transport';
|
|
2
|
-
import type { CommonParams, Response } from '../params';
|
|
3
|
-
|
|
4
|
-
export declare function deviceWriteSEPublicCert(
|
|
5
|
-
connectId: string,
|
|
6
|
-
params: CommonParams & WriteSEPublicCert
|
|
7
|
-
): Response<Success>;
|