@onekeyfe/hd-transport-react-native 0.3.8 → 0.3.10
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.map +1 -1
- package/dist/index.js +7 -4
- package/package.json +4 -4
- package/src/index.ts +3 -0
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,UAAU,IAAI,aAAa,EAC3B,MAAM,EAEN,cAAc,EAEf,MAAM,gCAAgC,CAAC;AAExC,OAAO,SAAiC,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAkB,QAAQ,EAA6B,MAAM,qBAAqB,CAAC;AAC1F,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AAavC,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAmBjE,MAAM,CAAC,OAAO,OAAO,uBAAuB;IAC1C,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IAEzC,SAAS,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,cAAc,CAAC,GAAG,SAAS,CAAC;IAEnE,UAAU,UAAS;IAEnB,OAAO,UAAS;IAEhB,WAAW,SAAQ;IAEnB,UAAU,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAQ;IAExC,GAAG,CAAC,EAAE,GAAG,CAAC;IAEV,OAAO,CAAC,EAAE,YAAY,CAAC;gBAEX,OAAO,EAAE,gBAAgB;IAIrC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY;IAKvC,SAAS,CAAC,UAAU,EAAE,GAAG;IAMzB,MAAM;IAIN,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC;IAYjC,SAAS;IA6FT,OAAO,CAAC,KAAK,EAAE,eAAe;;;IAwMpC,sBAAsB,CAAC,cAAc,EAAE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,7 @@ class ReactNativeBleTransport {
|
|
|
456
456
|
let bufferLength = 0;
|
|
457
457
|
let buffer$1 = [];
|
|
458
458
|
const subscription = characteristic.monitor((error, c) => {
|
|
459
|
-
var _a, _b, _c, _d;
|
|
459
|
+
var _a, _b, _c, _d, _e;
|
|
460
460
|
if (error) {
|
|
461
461
|
this.Log.debug(`error monitor ${characteristic.uuid}, deviceId: ${characteristic.deviceID}: ${error}`);
|
|
462
462
|
if (this.runPromise) {
|
|
@@ -464,7 +464,10 @@ class ReactNativeBleTransport {
|
|
|
464
464
|
if ((_a = error.reason) === null || _a === void 0 ? void 0 : _a.includes('The connection has timed out unexpectedly')) {
|
|
465
465
|
ERROR = hdShared.HardwareErrorCode.BleTimeoutError;
|
|
466
466
|
}
|
|
467
|
-
|
|
467
|
+
if ((_b = error.reason) === null || _b === void 0 ? void 0 : _b.includes('Encryption is insufficient')) {
|
|
468
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleDeviceNotBonded);
|
|
469
|
+
}
|
|
470
|
+
this.runPromise.reject(hdShared.ERRORS.TypedError(ERROR, (_c = error.reason) !== null && _c !== void 0 ? _c : error.message));
|
|
468
471
|
this.Log.debug(': monitor notify error, and has unreleased Promise');
|
|
469
472
|
}
|
|
470
473
|
return;
|
|
@@ -485,12 +488,12 @@ class ReactNativeBleTransport {
|
|
|
485
488
|
const value = buffer.Buffer.from(buffer$1);
|
|
486
489
|
bufferLength = 0;
|
|
487
490
|
buffer$1 = [];
|
|
488
|
-
(
|
|
491
|
+
(_d = this.runPromise) === null || _d === void 0 ? void 0 : _d.resolve(value.toString('hex'));
|
|
489
492
|
}
|
|
490
493
|
}
|
|
491
494
|
catch (error) {
|
|
492
495
|
this.Log.debug('monitor data error: ', error);
|
|
493
|
-
(
|
|
496
|
+
(_e = this.runPromise) === null || _e === void 0 ? void 0 : _e.reject(error);
|
|
494
497
|
}
|
|
495
498
|
});
|
|
496
499
|
return () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport-react-native",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"lint:fix": "eslint . --fix"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@onekeyfe/hd-shared": "^0.3.
|
|
23
|
-
"@onekeyfe/hd-transport": "^0.3.
|
|
22
|
+
"@onekeyfe/hd-shared": "^0.3.10",
|
|
23
|
+
"@onekeyfe/hd-transport": "^0.3.10",
|
|
24
24
|
"@onekeyfe/react-native-ble-plx": "3.0.0",
|
|
25
25
|
"react-native-ble-manager": "^8.1.0"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "c92353e115d6b8b16dbe1e9468b913a4a2cf807e"
|
|
28
28
|
}
|
package/src/index.ts
CHANGED
|
@@ -401,6 +401,9 @@ export default class ReactNativeBleTransport {
|
|
|
401
401
|
if (error.reason?.includes('The connection has timed out unexpectedly')) {
|
|
402
402
|
ERROR = HardwareErrorCode.BleTimeoutError;
|
|
403
403
|
}
|
|
404
|
+
if (error.reason?.includes('Encryption is insufficient')) {
|
|
405
|
+
throw ERRORS.TypedError(HardwareErrorCode.BleDeviceNotBonded);
|
|
406
|
+
}
|
|
404
407
|
this.runPromise.reject(ERRORS.TypedError(ERROR, error.reason ?? error.message));
|
|
405
408
|
this.Log.debug(': monitor notify error, and has unreleased Promise');
|
|
406
409
|
}
|