@onekeyfe/hd-transport-web-device 1.0.38-alpha.3 → 1.0.39-alpha.5
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/package.json +4 -4
- package/dist/webble-utils.d.ts +0 -4
- package/dist/webble-utils.d.ts.map +0 -1
- package/src/webble-utils.ts +0 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport-web-device",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39-alpha.5",
|
|
4
4
|
"author": "OneKey",
|
|
5
5
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"lint:fix": "eslint . --fix"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@onekeyfe/hd-shared": "^1.0.
|
|
24
|
-
"@onekeyfe/hd-transport": "^1.0.
|
|
23
|
+
"@onekeyfe/hd-shared": "^1.0.39-alpha.5",
|
|
24
|
+
"@onekeyfe/hd-transport": "^1.0.39-alpha.5"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/w3c-web-usb": "^1.0.6",
|
|
28
28
|
"@types/web-bluetooth": "^0.0.17"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "6c62185f4a620a760ee67a648003c7c1ee828d19"
|
|
31
31
|
}
|
package/dist/webble-utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webble-utils.d.ts","sourceRoot":"","sources":["../src/webble-utils.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,aAAa,UAAW,MAAM,GAAG,UAAU,KAAG,OAa1D,CAAC;AAEF,eAAO,MAAM,cAAc,SAAU,MAAM,GAAG,IAAI,OAAO,MAAM,KAAG,OAYjE,CAAC"}
|
package/src/webble-utils.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { MESSAGE_TOP_CHAR, MESSAGE_HEADER_BYTE } from '@onekeyfe/hd-transport';
|
|
2
|
-
|
|
3
|
-
export const isHeaderChunk = (chunk: Buffer | Uint8Array): boolean => {
|
|
4
|
-
if (chunk.length < 9) return false;
|
|
5
|
-
const [MagicQuestionMark, sharp1, sharp2] = chunk;
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
String.fromCharCode(MagicQuestionMark) === String.fromCharCode(MESSAGE_TOP_CHAR) &&
|
|
9
|
-
String.fromCharCode(sharp1) === String.fromCharCode(MESSAGE_HEADER_BYTE) &&
|
|
10
|
-
String.fromCharCode(sharp2) === String.fromCharCode(MESSAGE_HEADER_BYTE)
|
|
11
|
-
) {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return false;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const isOnekeyDevice = (name: string | null, id?: string): boolean => {
|
|
19
|
-
if (id?.startsWith?.('MI')) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// 过滤 BixinKeyxxx 和 Kxxxx 和 Txxxx
|
|
24
|
-
// i 忽略大小写模式
|
|
25
|
-
const re = /(BixinKey\d{10})|(K\d{4})|(T\d{4})|(Touch\s\w{4})|(Pro\s\w{4})/i;
|
|
26
|
-
if (name && re.exec(name)) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
return false;
|
|
30
|
-
};
|