@onekeyfe/hd-transport 1.0.22-alpha.2 → 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/index.d.ts +1 -2
- package/dist/types/transport.d.ts +3 -2
- package/dist/types/transport.d.ts.map +1 -1
- package/package.json +5 -3
- package/src/types/transport.ts +3 -5
- package/tsconfig.json +4 -0
package/dist/index.d.ts
CHANGED
|
@@ -68,14 +68,13 @@ type Transport = {
|
|
|
68
68
|
post(session: string, name: string, data: Record<string, any>): Promise<void>;
|
|
69
69
|
read(session: string): Promise<MessageFromOneKey>;
|
|
70
70
|
cancel(): Promise<void>;
|
|
71
|
+
promptDeviceAccess?: () => Promise<USBDevice | BluetoothDevice | null>;
|
|
71
72
|
init: ITransportInitFn;
|
|
72
73
|
stop(): void;
|
|
73
74
|
configured: boolean;
|
|
74
75
|
version: string;
|
|
75
76
|
name: string;
|
|
76
77
|
activeName?: string;
|
|
77
|
-
requestDevice: () => Promise<void>;
|
|
78
|
-
requestNeeded: boolean;
|
|
79
78
|
isOutdated: boolean;
|
|
80
79
|
};
|
|
81
80
|
type LowLevelDevice = {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="w3c-web-usb" />
|
|
2
|
+
/// <reference types="web-bluetooth" />
|
|
1
3
|
/// <reference types="node" />
|
|
2
4
|
import type EventEmitter from 'events';
|
|
3
5
|
export type OneKeyUsbDeviceInfo = {
|
|
@@ -34,14 +36,13 @@ export type Transport = {
|
|
|
34
36
|
post(session: string, name: string, data: Record<string, any>): Promise<void>;
|
|
35
37
|
read(session: string): Promise<MessageFromOneKey>;
|
|
36
38
|
cancel(): Promise<void>;
|
|
39
|
+
promptDeviceAccess?: () => Promise<USBDevice | BluetoothDevice | null>;
|
|
37
40
|
init: ITransportInitFn;
|
|
38
41
|
stop(): void;
|
|
39
42
|
configured: boolean;
|
|
40
43
|
version: string;
|
|
41
44
|
name: string;
|
|
42
45
|
activeName?: string;
|
|
43
|
-
requestDevice: () => Promise<void>;
|
|
44
|
-
requestNeeded: boolean;
|
|
45
46
|
isOutdated: boolean;
|
|
46
47
|
};
|
|
47
48
|
export type LowLevelDevice = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/types/transport.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/types/transport.ts"],"names":[],"mappings":";;;AAAA,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AAEvC,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,mBAAmB,GAAG;IAC9D,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,2BAA2B,GAAG,sBAAsB,CAAC;AAEpF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,CAAC;AAE/E,KAAK,gBAAgB,GAAG,CACtB,MAAM,CAAC,EAAE,GAAG,EACZ,OAAO,CAAC,EAAE,YAAY,EACtB,MAAM,C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C;IAEpB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAC1D,MAAM,MAAM,6BAA6B,GAAG;IAC1C,SAAS,EAAE,MAAM,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAC3C,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5C,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport",
|
|
3
|
-
"version": "1.0.22
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -19,12 +19,14 @@
|
|
|
19
19
|
"update:protobuf": "./scripts/protobuf-build.sh"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@types/bytebuffer": "^5.0.42"
|
|
22
|
+
"@types/bytebuffer": "^5.0.42",
|
|
23
|
+
"@types/w3c-web-usb": "^1.0.10",
|
|
24
|
+
"@types/web-bluetooth": "^0.0.21"
|
|
23
25
|
},
|
|
24
26
|
"dependencies": {
|
|
25
27
|
"bytebuffer": "^5.0.1",
|
|
26
28
|
"long": "^4.0.0",
|
|
27
29
|
"protobufjs": "^6.11.2"
|
|
28
30
|
},
|
|
29
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "91124a7846f8366bb1c2294fc3d983c6e2adf535"
|
|
30
32
|
}
|
package/src/types/transport.ts
CHANGED
|
@@ -43,6 +43,9 @@ export type Transport = {
|
|
|
43
43
|
read(session: string): Promise<MessageFromOneKey>;
|
|
44
44
|
cancel(): Promise<void>;
|
|
45
45
|
|
|
46
|
+
// web-usb, web-bluetooth request device
|
|
47
|
+
promptDeviceAccess?: () => Promise<USBDevice | BluetoothDevice | null>;
|
|
48
|
+
|
|
46
49
|
// resolves when the transport can be used; rejects when it cannot
|
|
47
50
|
init: ITransportInitFn;
|
|
48
51
|
stop(): void;
|
|
@@ -52,11 +55,6 @@ export type Transport = {
|
|
|
52
55
|
name: string;
|
|
53
56
|
activeName?: string;
|
|
54
57
|
|
|
55
|
-
// webusb has a different model, where you have to
|
|
56
|
-
// request device connection
|
|
57
|
-
requestDevice: () => Promise<void>;
|
|
58
|
-
requestNeeded: boolean;
|
|
59
|
-
|
|
60
58
|
isOutdated: boolean;
|
|
61
59
|
};
|
|
62
60
|
|