@trezor/connect 9.0.10 → 9.1.1
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/CHANGELOG.md +13 -0
- package/README.md +19 -2
- package/lib/api/bitcoin/createPendingTx.d.ts +1 -0
- package/lib/api/bitcoin/createPendingTx.js +1 -0
- package/lib/api/cancelCoinjoinAuthorization.d.ts +7 -0
- package/lib/api/cancelCoinjoinAuthorization.js +25 -0
- package/lib/api/cardanoGetPublicKey.d.ts +1 -0
- package/lib/api/cardanoGetPublicKey.js +9 -0
- package/lib/api/cipherKeyValue.js +3 -2
- package/lib/api/getAccountInfo.d.ts +2 -0
- package/lib/api/getPublicKey.d.ts +1 -0
- package/lib/api/getPublicKey.js +9 -0
- package/lib/api/index.d.ts +2 -0
- package/lib/api/index.js +6 -2
- package/lib/api/rebootToBootloader.js +1 -1
- package/lib/api/showDeviceTutorial.d.ts +7 -0
- package/lib/api/showDeviceTutorial.js +21 -0
- package/lib/constants/errors.d.ts +0 -3
- package/lib/constants/errors.js +1 -4
- package/lib/core/index.d.ts +5 -6
- package/lib/core/index.js +44 -50
- package/lib/core/method.d.ts +1 -1
- package/lib/data/coinInfo.d.ts +0 -1
- package/lib/data/coinInfo.js +7 -14
- package/lib/data/config.js +7 -1
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +16 -24
- package/lib/device/Device.js +71 -107
- package/lib/device/DeviceCommands.d.ts +4 -3
- package/lib/device/DeviceCommands.js +42 -20
- package/lib/device/DeviceList.d.ts +17 -33
- package/lib/device/DeviceList.js +230 -264
- package/lib/events/transport.d.ts +2 -9
- package/lib/events/transport.js +3 -10
- package/lib/factory.js +2 -0
- package/lib/index.js +7 -7
- package/lib/types/api/cancelCoinjoinAuthorization.d.ts +8 -0
- package/lib/types/api/cancelCoinjoinAuthorization.js +3 -0
- package/lib/types/api/index.d.ts +4 -0
- package/lib/types/api/showDeviceTutorial.d.ts +4 -0
- package/lib/types/api/showDeviceTutorial.js +3 -0
- package/lib/types/device.d.ts +1 -1
- package/lib/types/device.js +3 -0
- package/lib/types/settings.d.ts +1 -1
- package/lib/utils/debug.js +2 -1
- package/lib/utils/deviceFeaturesUtils.d.ts +2 -1
- package/lib/utils/deviceFeaturesUtils.js +12 -1
- package/lib/workers/workers-browser.d.ts +1 -3
- package/lib/workers/workers-browser.js +1 -7
- package/lib/workers/workers-react-native.d.ts +1 -3
- package/lib/workers/workers-react-native.js +1 -7
- package/lib/workers/workers.d.ts +1 -5
- package/lib/workers/workers.js +1 -5
- package/package.json +21 -18
- package/lib/device/DescriptorStream.d.ts +0 -28
- package/lib/device/DescriptorStream.js +0 -139
- package/lib/utils/objectUtils.d.ts +0 -10
- package/lib/utils/objectUtils.js +0 -37
- package/lib/workers/RNUsbPlugin.d.ts +0 -31
- package/lib/workers/RNUsbPlugin.js +0 -65
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ReactNativePlugin = void 0;
|
|
4
|
-
const react_native_1 = require("react-native");
|
|
5
|
-
const bufferToHex = (buffer) => Array.prototype.map.call(new Uint8Array(buffer), x => `00${x.toString(16)}`.slice(-2)).join('');
|
|
6
|
-
const toArrayBuffer = (buffer) => {
|
|
7
|
-
const ab = new ArrayBuffer(buffer.length);
|
|
8
|
-
const view = new Uint8Array(ab);
|
|
9
|
-
const len = buffer.length;
|
|
10
|
-
for (let i = 0; i < len; ++i) {
|
|
11
|
-
view[i] = buffer[i];
|
|
12
|
-
}
|
|
13
|
-
return ab;
|
|
14
|
-
};
|
|
15
|
-
class ReactNativePlugin {
|
|
16
|
-
constructor() {
|
|
17
|
-
this.name = 'ReactNativePlugin';
|
|
18
|
-
this.version = '1.0.0';
|
|
19
|
-
this.debug = false;
|
|
20
|
-
this.allowsWriteAndEnumerate = true;
|
|
21
|
-
this.requestNeeded = false;
|
|
22
|
-
this.usb = react_native_1.NativeModules.TrezorTransport;
|
|
23
|
-
}
|
|
24
|
-
init(debug) {
|
|
25
|
-
this.debug = !!debug;
|
|
26
|
-
if (!this.usb) {
|
|
27
|
-
throw new Error('ReactNative plugin is not available');
|
|
28
|
-
}
|
|
29
|
-
return Promise.resolve();
|
|
30
|
-
}
|
|
31
|
-
enumerate() {
|
|
32
|
-
return this.usb.enumerate();
|
|
33
|
-
}
|
|
34
|
-
send(path, data, debugLink) {
|
|
35
|
-
const dataHex = bufferToHex(data);
|
|
36
|
-
return this.usb.write(path, debugLink, dataHex);
|
|
37
|
-
}
|
|
38
|
-
async receive(path, debugLink) {
|
|
39
|
-
const { data } = await this.usb.read(path, debugLink);
|
|
40
|
-
return toArrayBuffer(Buffer.from(data, 'hex'));
|
|
41
|
-
}
|
|
42
|
-
async connect(path, debugLink) {
|
|
43
|
-
for (let i = 0; i < 5; i++) {
|
|
44
|
-
if (i > 0) {
|
|
45
|
-
await new Promise(resolve => setTimeout(resolve, i * 200));
|
|
46
|
-
}
|
|
47
|
-
try {
|
|
48
|
-
await this.usb.acquire(path, debugLink);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
catch (e) {
|
|
52
|
-
if (i === 4) {
|
|
53
|
-
throw e;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
disconnect(path, debugLink, last) {
|
|
59
|
-
return this.usb.release(path, debugLink, last);
|
|
60
|
-
}
|
|
61
|
-
requestDevice() {
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.ReactNativePlugin = ReactNativePlugin;
|
|
65
|
-
//# sourceMappingURL=RNUsbPlugin.js.map
|