@trezor/connect 9.2.4 → 9.2.5-beta.2
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 +125 -9
- package/README.md +2 -2
- package/lib/api/applySettings.js +1 -9
- package/lib/api/cardano/api/cardanoSignTransaction.d.ts +4 -1
- package/lib/api/cardano/api/cardanoSignTransaction.js +16 -1
- package/lib/api/cardano/cardanoCertificate.js +34 -0
- package/lib/api/cardano/cardanoWitnesses.js +4 -1
- package/lib/api/getFeatures.d.ts +6 -4
- package/lib/api/getPublicKey.d.ts +1 -1
- package/lib/api/getPublicKey.js +3 -3
- package/lib/api/index.d.ts +1 -0
- package/lib/api/index.js +3 -1
- package/lib/api/recoveryDevice.js +1 -1
- package/lib/api/setBrightness.d.ts +9 -0
- package/lib/api/setBrightness.js +23 -0
- package/lib/api/solana/api/solanaGetAddress.d.ts +1 -1
- package/lib/api/solana/api/solanaGetAddress.js +1 -1
- package/lib/backend/BackendManager.d.ts +1 -2
- package/lib/backend/BackendManager.js +6 -5
- package/lib/backend/BlockchainLink.js +1 -3
- package/lib/core/coreManager.d.ts +16 -0
- package/lib/core/coreManager.js +55 -0
- package/lib/core/index.d.ts +7 -1
- package/lib/core/index.js +44 -32
- package/lib/data/deviceAuthenticityConfig.js +4 -1
- package/lib/data/models.js +4 -4
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.js +5 -0
- package/lib/device/DeviceList.js +2 -0
- package/lib/factory.d.ts +2 -3
- package/lib/factory.js +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +27 -29
- package/lib/types/api/applySettings.d.ts +1 -0
- package/lib/types/api/cardano/index.d.ts +26 -0
- package/lib/types/api/cardano/index.js +9 -1
- package/lib/types/api/index.d.ts +7 -5
- package/lib/types/api/recoveryDevice.d.ts +2 -2
- package/lib/types/api/setBrightness.d.ts +4 -0
- package/lib/types/api/setBrightness.js +3 -0
- package/package.json +14 -15
package/lib/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.initCoreState = exports.Core = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const events_1 = tslib_1.__importDefault(require("events"));
|
|
6
6
|
const transport_1 = require("@trezor/transport");
|
|
@@ -20,6 +20,7 @@ const debug_1 = require("../utils/debug");
|
|
|
20
20
|
const BlockchainLink_1 = require("../backend/BlockchainLink");
|
|
21
21
|
const interactionTimeout_1 = require("../utils/interactionTimeout");
|
|
22
22
|
const onCallFirmwareUpdate_1 = require("./onCallFirmwareUpdate");
|
|
23
|
+
const coreManager_1 = require("./coreManager");
|
|
23
24
|
let _core;
|
|
24
25
|
let _deviceList;
|
|
25
26
|
const _callMethods = [];
|
|
@@ -55,6 +56,9 @@ const initDevice = async (devicePath) => {
|
|
|
55
56
|
throw constants_1.ERRORS.TypedError('Transport_Missing');
|
|
56
57
|
}
|
|
57
58
|
await _deviceList.transportFirstEventPromise;
|
|
59
|
+
if (!_deviceList) {
|
|
60
|
+
throw constants_1.ERRORS.TypedError('Transport_Missing');
|
|
61
|
+
}
|
|
58
62
|
const isWebUsb = _deviceList.transportType() === 'WebUsbTransport';
|
|
59
63
|
let device;
|
|
60
64
|
let showDeviceSelection = isWebUsb;
|
|
@@ -196,7 +200,7 @@ const inner = async (method, device) => {
|
|
|
196
200
|
return Promise.reject(constants_1.ERRORS.TypedError('Method_PermissionsNotGranted'));
|
|
197
201
|
}
|
|
198
202
|
}
|
|
199
|
-
const deviceNeedsBackup = device.features.
|
|
203
|
+
const deviceNeedsBackup = device.features.backup_availability === 'Required';
|
|
200
204
|
if (deviceNeedsBackup) {
|
|
201
205
|
if (method.noBackupConfirmationMode === 'always' ||
|
|
202
206
|
(method.noBackupConfirmationMode === 'popup-only' && isUsingPopup)) {
|
|
@@ -456,6 +460,9 @@ const onCall = async (message) => {
|
|
|
456
460
|
}
|
|
457
461
|
}
|
|
458
462
|
await device.cleanup();
|
|
463
|
+
if (useCoreInPopup) {
|
|
464
|
+
postMessage(response);
|
|
465
|
+
}
|
|
459
466
|
closePopup();
|
|
460
467
|
cleanup();
|
|
461
468
|
if (method) {
|
|
@@ -466,7 +473,9 @@ const onCall = async (message) => {
|
|
|
466
473
|
_deviceList.removeAuthPenalty(device);
|
|
467
474
|
}
|
|
468
475
|
}
|
|
469
|
-
|
|
476
|
+
if (!useCoreInPopup) {
|
|
477
|
+
postMessage(response);
|
|
478
|
+
}
|
|
470
479
|
}
|
|
471
480
|
}
|
|
472
481
|
};
|
|
@@ -654,6 +663,7 @@ class Core extends events_1.default {
|
|
|
654
663
|
popupPromise.resolve();
|
|
655
664
|
break;
|
|
656
665
|
case events_2.POPUP.CLOSED:
|
|
666
|
+
popupPromise.clear();
|
|
657
667
|
onPopupClosed(message.payload ? message.payload.error : null);
|
|
658
668
|
break;
|
|
659
669
|
case transport_1.TRANSPORT.DISABLE_WEBUSB:
|
|
@@ -728,38 +738,36 @@ class Core extends events_1.default {
|
|
|
728
738
|
}
|
|
729
739
|
_deviceList.enumerate();
|
|
730
740
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
if (logWriterFactory) {
|
|
735
|
-
(0, debug_1.setLogWriter)(logWriterFactory);
|
|
736
|
-
}
|
|
737
|
-
try {
|
|
738
|
-
await DataManager_1.DataManager.load(settings);
|
|
739
|
-
(0, debug_1.enableLog)(DataManager_1.DataManager.getSettings('debug'));
|
|
740
|
-
_core = new Core();
|
|
741
|
-
_interactionTimeout = new interactionTimeout_1.InteractionTimeout(settings.popup ? settings.interactionTimeout : 0);
|
|
742
|
-
_core.on(events_2.CORE_EVENT, onCoreEvent);
|
|
743
|
-
}
|
|
744
|
-
catch (error) {
|
|
745
|
-
_log.error('init', error);
|
|
746
|
-
throw error;
|
|
747
|
-
}
|
|
748
|
-
try {
|
|
749
|
-
if (!DataManager_1.DataManager.getSettings('transportReconnect')) {
|
|
750
|
-
await initDeviceList(false);
|
|
741
|
+
async init(settings, onCoreEvent, logWriterFactory) {
|
|
742
|
+
if (logWriterFactory) {
|
|
743
|
+
(0, debug_1.setLogWriter)(logWriterFactory);
|
|
751
744
|
}
|
|
752
|
-
|
|
753
|
-
|
|
745
|
+
try {
|
|
746
|
+
await DataManager_1.DataManager.load(settings);
|
|
747
|
+
(0, debug_1.enableLog)(DataManager_1.DataManager.getSettings('debug'));
|
|
748
|
+
_core = this;
|
|
749
|
+
_interactionTimeout = new interactionTimeout_1.InteractionTimeout(settings.popup ? settings.interactionTimeout : 0);
|
|
750
|
+
this.on(events_2.CORE_EVENT, onCoreEvent);
|
|
751
|
+
}
|
|
752
|
+
catch (error) {
|
|
753
|
+
_log.error('init', error);
|
|
754
|
+
throw error;
|
|
755
|
+
}
|
|
756
|
+
try {
|
|
757
|
+
if (!DataManager_1.DataManager.getSettings('transportReconnect')) {
|
|
758
|
+
await initDeviceList(false);
|
|
759
|
+
}
|
|
760
|
+
else {
|
|
761
|
+
initDeviceList(true);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
catch (error) {
|
|
765
|
+
_log.error('initTransport', error);
|
|
766
|
+
throw error;
|
|
754
767
|
}
|
|
755
768
|
}
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
throw error;
|
|
759
|
-
}
|
|
760
|
-
return _core;
|
|
761
|
-
};
|
|
762
|
-
exports.initCore = initCore;
|
|
769
|
+
}
|
|
770
|
+
exports.Core = Core;
|
|
763
771
|
const disableWebUSBTransport = async () => {
|
|
764
772
|
var _a;
|
|
765
773
|
if (!_deviceList)
|
|
@@ -783,4 +791,8 @@ const disableWebUSBTransport = async () => {
|
|
|
783
791
|
catch (error) {
|
|
784
792
|
}
|
|
785
793
|
};
|
|
794
|
+
const initCoreState = () => {
|
|
795
|
+
return (0, coreManager_1.initCoreManager)(new Core());
|
|
796
|
+
};
|
|
797
|
+
exports.initCoreState = initCoreState;
|
|
786
798
|
//# sourceMappingURL=index.js.map
|
|
@@ -25,7 +25,7 @@ exports.DeviceAuthenticityConfig = schema_utils_1.Type.Intersect([
|
|
|
25
25
|
]);
|
|
26
26
|
exports.deviceAuthenticityConfig = {
|
|
27
27
|
version: 1,
|
|
28
|
-
timestamp: '2024-05-
|
|
28
|
+
timestamp: '2024-05-31T12:00:00+00:00',
|
|
29
29
|
T2B1: {
|
|
30
30
|
rootPubKeys: [
|
|
31
31
|
'04ca97480ac0d7b1e6efafe518cd433cec2bf8ab9822d76eafd34363b55d63e60380bff20acc75cde03cffcb50ab6f8ce70c878e37ebc58ff7cca0a83b16b15fa5',
|
|
@@ -52,6 +52,9 @@ exports.deviceAuthenticityConfig = {
|
|
|
52
52
|
'04d7ddaf7e17a678bef305950f0f9d74b90553d8502fd02c439f07ac7ea494e9e0519a1c5782bf23be058162e706057d3b241d507f89b9e5518e3696a92128fa6d',
|
|
53
53
|
'0488cf1dbadb18df0a094da837b3eeb0c85489cc21e7c2b94f8f4df207edccfddbb58e428d9a6ce1e42081c38665d134c7ee6f1f524688ce7444bc1d1340a8b1f1',
|
|
54
54
|
'04ff0c6e817d7c00a0912cf1d293e4d3a8c25403dca4e8ced5e7323352e34604725ad67739d1b4bf538a3864e95d8311ebc91d522b1603da94061e82535edced56',
|
|
55
|
+
'0445f15e55a044b1516a7b2cc13dd4e9ea415336f622b9185e4ffc19e2b51627637491195c85f87ac2582ac4a8d89a33983f0700d042fd7e57d55d346f4fbc832c',
|
|
56
|
+
'042b9cede77aa38f1d824ebd5e13129c8c1c163f3ea74b5251e420831ec17329be741b2af96cc6df0c253e4bffdac23f4bb373e53ae1821587ce0ecae476d2b95c',
|
|
57
|
+
'040cea26562b3763dddd741f4428f37cdc931dbd2db9665888505c2be42868ee2d739aed1d0a54c116b889f5d1ff57dae8dcc1e595cf6d69e71853a8053449ab9f',
|
|
55
58
|
],
|
|
56
59
|
debug: {
|
|
57
60
|
rootPubKeys: [
|
package/lib/data/models.js
CHANGED
|
@@ -23,10 +23,10 @@ exports.models = {
|
|
|
23
23
|
T3T1: {
|
|
24
24
|
name: 'Trezor Safe 5',
|
|
25
25
|
colors: {
|
|
26
|
-
'1': '
|
|
27
|
-
'2': '
|
|
28
|
-
'3': '
|
|
29
|
-
'4': '
|
|
26
|
+
'1': 'Black Graphite',
|
|
27
|
+
'2': 'Violet Ore',
|
|
28
|
+
'3': 'Green Beryl',
|
|
29
|
+
'4': 'Bitcoin Orange',
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
32
|
};
|
package/lib/data/version.d.ts
CHANGED
package/lib/data/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEFAULT_DOMAIN = exports.VERSION = void 0;
|
|
4
|
-
exports.VERSION = '9.2.
|
|
4
|
+
exports.VERSION = '9.2.5-beta.2';
|
|
5
5
|
const versionN = exports.VERSION.split('.').map(s => parseInt(s, 10));
|
|
6
6
|
const isBeta = exports.VERSION.includes('beta');
|
|
7
7
|
exports.DEFAULT_DOMAIN = isBeta
|
package/lib/device/Device.js
CHANGED
|
@@ -112,9 +112,11 @@ class Device extends utils_1.TypedEmitter {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
async cleanup() {
|
|
115
|
+
const acquiredListeners = this.listeners(events_1.DEVICE.ACQUIRED);
|
|
115
116
|
this.removeAllListeners();
|
|
116
117
|
delete this.runPromise;
|
|
117
118
|
await this.release();
|
|
119
|
+
acquiredListeners.forEach(l => this.once(events_1.DEVICE.ACQUIRED, l));
|
|
118
120
|
}
|
|
119
121
|
run(fn, options) {
|
|
120
122
|
if (this.runPromise) {
|
|
@@ -245,6 +247,9 @@ class Device extends utils_1.TypedEmitter {
|
|
|
245
247
|
}
|
|
246
248
|
else if (state !== this.internalState[this.instance]) {
|
|
247
249
|
this.internalState[this.instance] = state;
|
|
250
|
+
if (this.useLegacyPassphrase() && this.isT1()) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
248
253
|
this.emit(events_1.DEVICE.SAVE_STATE, state);
|
|
249
254
|
}
|
|
250
255
|
}
|
package/lib/device/DeviceList.js
CHANGED
|
@@ -175,6 +175,7 @@ class DeviceList extends utils_1.TypedEmitter {
|
|
|
175
175
|
session: d.session,
|
|
176
176
|
path: d.path,
|
|
177
177
|
product: d.product,
|
|
178
|
+
type: d.type,
|
|
178
179
|
};
|
|
179
180
|
}
|
|
180
181
|
});
|
|
@@ -293,6 +294,7 @@ class DeviceList extends utils_1.TypedEmitter {
|
|
|
293
294
|
session: d.session,
|
|
294
295
|
path: d.path,
|
|
295
296
|
product: d.product,
|
|
297
|
+
type: d.type,
|
|
296
298
|
};
|
|
297
299
|
this.devices[d.path].activitySessionID = d.session;
|
|
298
300
|
}
|
package/lib/factory.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { EventEmitter } from 'events';
|
|
3
3
|
import type { TrezorConnect } from './types';
|
|
4
4
|
import type { CallMethod } from './events/call';
|
|
5
|
-
interface
|
|
5
|
+
export interface ConnectFactoryDependencies {
|
|
6
6
|
call: CallMethod;
|
|
7
7
|
eventEmitter: EventEmitter;
|
|
8
8
|
manifest: TrezorConnect['manifest'];
|
|
@@ -15,6 +15,5 @@ interface Dependencies {
|
|
|
15
15
|
cancel: TrezorConnect['cancel'];
|
|
16
16
|
dispose: TrezorConnect['dispose'];
|
|
17
17
|
}
|
|
18
|
-
export declare const factory: ({ eventEmitter, manifest, init, call, requestLogin, uiResponse, renderWebUSBButton, disableWebUSB, requestWebUSBDevice, cancel, dispose, }:
|
|
19
|
-
export {};
|
|
18
|
+
export declare const factory: ({ eventEmitter, manifest, init, call, requestLogin, uiResponse, renderWebUSBButton, disableWebUSB, requestWebUSBDevice, cancel, dispose, }: ConnectFactoryDependencies) => TrezorConnect;
|
|
20
19
|
//# sourceMappingURL=factory.d.ts.map
|
package/lib/factory.js
CHANGED
|
@@ -127,6 +127,7 @@ const factory = ({ eventEmitter, manifest, init, call, requestLogin, uiResponse,
|
|
|
127
127
|
recoveryDevice: params => call({ ...params, method: 'recoveryDevice' }),
|
|
128
128
|
getCoinInfo: params => call({ ...params, method: 'getCoinInfo' }),
|
|
129
129
|
rebootToBootloader: params => call({ ...params, method: 'rebootToBootloader' }),
|
|
130
|
+
setBrightness: params => call({ ...params, method: 'setBrightness' }),
|
|
130
131
|
setBusy: params => call({ ...params, method: 'setBusy' }),
|
|
131
132
|
setProxy: params => call({ ...params, method: 'setProxy' }),
|
|
132
133
|
dispose,
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import EventEmitter from 'events';
|
|
3
|
-
export declare const eventEmitter: EventEmitter
|
|
3
|
+
export declare const eventEmitter: EventEmitter<[never]>;
|
|
4
4
|
declare const TrezorConnect: import("./types").TrezorConnect;
|
|
5
5
|
export default TrezorConnect;
|
|
6
6
|
export * from './exports';
|
package/lib/index.js
CHANGED
|
@@ -13,7 +13,7 @@ const constants_1 = require("./constants");
|
|
|
13
13
|
exports.eventEmitter = new events_1.default();
|
|
14
14
|
const _log = (0, debug_1.initLog)('@trezor/connect');
|
|
15
15
|
let _settings = (0, connectSettings_1.parseConnectSettings)();
|
|
16
|
-
|
|
16
|
+
const coreManager = (0, core_1.initCoreState)();
|
|
17
17
|
const messagePromises = (0, utils_1.createDeferredManager)({ initialId: 1 });
|
|
18
18
|
const manifest = (data) => {
|
|
19
19
|
_settings = (0, connectSettings_1.parseConnectSettings)({
|
|
@@ -24,17 +24,13 @@ const manifest = (data) => {
|
|
|
24
24
|
const dispose = () => {
|
|
25
25
|
exports.eventEmitter.removeAllListeners();
|
|
26
26
|
_settings = (0, connectSettings_1.parseConnectSettings)();
|
|
27
|
-
|
|
28
|
-
_core.dispose();
|
|
29
|
-
_core = null;
|
|
30
|
-
}
|
|
27
|
+
coreManager.dispose();
|
|
31
28
|
};
|
|
32
|
-
const
|
|
29
|
+
const onCoreEvent = (message) => {
|
|
30
|
+
var _a;
|
|
33
31
|
const { event, type, payload } = message;
|
|
34
|
-
if (!_core)
|
|
35
|
-
return;
|
|
36
32
|
if (type === events_2.UI.REQUEST_UI_WINDOW) {
|
|
37
|
-
|
|
33
|
+
(_a = coreManager.getCore()) === null || _a === void 0 ? void 0 : _a.handleMessage({ type: events_2.POPUP.HANDSHAKE });
|
|
38
34
|
return;
|
|
39
35
|
}
|
|
40
36
|
if (type === events_2.POPUP.CANCEL_POPUP_REQUEST)
|
|
@@ -70,7 +66,7 @@ const handleMessage = (message) => {
|
|
|
70
66
|
};
|
|
71
67
|
const init = async (settings = {}) => {
|
|
72
68
|
var _a;
|
|
73
|
-
if (
|
|
69
|
+
if (coreManager.getCore() || coreManager.getInitPromise()) {
|
|
74
70
|
throw constants_1.ERRORS.TypedError('Init_AlreadyInitialized');
|
|
75
71
|
}
|
|
76
72
|
_settings = (0, connectSettings_1.parseConnectSettings)({ ..._settings, ...settings, popup: false });
|
|
@@ -84,23 +80,22 @@ const init = async (settings = {}) => {
|
|
|
84
80
|
_settings.lazyLoad = false;
|
|
85
81
|
return;
|
|
86
82
|
}
|
|
87
|
-
|
|
83
|
+
await coreManager.getOrInitCore(_settings, onCoreEvent);
|
|
88
84
|
};
|
|
89
85
|
const call = async (params) => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
catch (error) {
|
|
95
|
-
return (0, events_2.createErrorMessage)(error);
|
|
86
|
+
let core;
|
|
87
|
+
try {
|
|
88
|
+
if (!coreManager.getCore() && !coreManager.getInitPromise()) {
|
|
89
|
+
await init();
|
|
96
90
|
}
|
|
91
|
+
core = await coreManager.getOrInitCore(_settings, onCoreEvent);
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
return (0, events_2.createErrorMessage)(error);
|
|
97
95
|
}
|
|
98
96
|
try {
|
|
99
|
-
if (!_core) {
|
|
100
|
-
throw constants_1.ERRORS.TypedError('Runtime', 'postMessage: _core not found');
|
|
101
|
-
}
|
|
102
97
|
const { promiseId, promise } = messagePromises.create();
|
|
103
|
-
|
|
98
|
+
core.handleMessage({
|
|
104
99
|
type: events_2.IFRAME.CALL,
|
|
105
100
|
payload: params,
|
|
106
101
|
id: promiseId,
|
|
@@ -117,49 +112,52 @@ const call = async (params) => {
|
|
|
117
112
|
}
|
|
118
113
|
};
|
|
119
114
|
const uiResponse = (response) => {
|
|
120
|
-
|
|
115
|
+
const core = coreManager.getCore();
|
|
116
|
+
if (!core) {
|
|
121
117
|
throw constants_1.ERRORS.TypedError('Init_NotInitialized');
|
|
122
118
|
}
|
|
123
|
-
|
|
119
|
+
core.handleMessage(response);
|
|
124
120
|
};
|
|
125
121
|
const requestLogin = async (params) => {
|
|
126
122
|
if (typeof params.callback === 'function') {
|
|
127
123
|
const { callback } = params;
|
|
124
|
+
const core = coreManager.getCore();
|
|
128
125
|
const loginChallengeListener = async (event) => {
|
|
129
126
|
const { data } = event;
|
|
130
127
|
if (data && data.type === events_2.UI.LOGIN_CHALLENGE_REQUEST) {
|
|
131
128
|
try {
|
|
132
129
|
const payload = await callback();
|
|
133
|
-
|
|
130
|
+
core === null || core === void 0 ? void 0 : core.handleMessage({
|
|
134
131
|
type: events_2.UI.LOGIN_CHALLENGE_RESPONSE,
|
|
135
132
|
payload,
|
|
136
133
|
});
|
|
137
134
|
}
|
|
138
135
|
catch (error) {
|
|
139
|
-
|
|
136
|
+
core === null || core === void 0 ? void 0 : core.handleMessage({
|
|
140
137
|
type: events_2.UI.LOGIN_CHALLENGE_RESPONSE,
|
|
141
138
|
payload: error.message,
|
|
142
139
|
});
|
|
143
140
|
}
|
|
144
141
|
}
|
|
145
142
|
};
|
|
146
|
-
|
|
143
|
+
core === null || core === void 0 ? void 0 : core.on(events_2.CORE_EVENT, loginChallengeListener);
|
|
147
144
|
const response = await call({
|
|
148
145
|
method: 'requestLogin',
|
|
149
146
|
...params,
|
|
150
147
|
asyncChallenge: true,
|
|
151
148
|
callback: null,
|
|
152
149
|
});
|
|
153
|
-
|
|
150
|
+
core === null || core === void 0 ? void 0 : core.removeListener(events_2.CORE_EVENT, loginChallengeListener);
|
|
154
151
|
return response;
|
|
155
152
|
}
|
|
156
153
|
return call({ method: 'requestLogin', ...params });
|
|
157
154
|
};
|
|
158
155
|
const cancel = (error) => {
|
|
159
|
-
|
|
156
|
+
const core = coreManager.getCore();
|
|
157
|
+
if (!core) {
|
|
160
158
|
throw constants_1.ERRORS.TypedError('Runtime', 'postMessage: _core not found');
|
|
161
159
|
}
|
|
162
|
-
|
|
160
|
+
core.handleMessage({
|
|
163
161
|
type: events_2.POPUP.CLOSED,
|
|
164
162
|
payload: error ? { error } : null,
|
|
165
163
|
});
|
|
@@ -15,6 +15,7 @@ export declare const ApplySettings: import("@sinclair/typebox").TObject<{
|
|
|
15
15
|
safety_checks: import("@sinclair/typebox").TOptional<import("@trezor/schema-utils/lib/custom-types/keyof-enum").TKeyOfEnum<typeof PROTO.Enum_SafetyCheckLevel>>;
|
|
16
16
|
experimental_features: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
17
17
|
hide_passphrase_from_host: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
18
|
+
haptic_feedback: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
18
19
|
}>;
|
|
19
20
|
export declare function applySettings(params: Params<ApplySettings>): Response<PROTO.Success>;
|
|
20
21
|
//# sourceMappingURL=applySettings.d.ts.map
|
|
@@ -194,6 +194,12 @@ export declare const CardanoPoolParameters: import("@sinclair/typebox").TObject<
|
|
|
194
194
|
hash: import("@sinclair/typebox").TString;
|
|
195
195
|
}>>;
|
|
196
196
|
}>;
|
|
197
|
+
export type CardanoDRep = Static<typeof CardanoDRep>;
|
|
198
|
+
export declare const CardanoDRep: import("@sinclair/typebox").TObject<{
|
|
199
|
+
type: import("@sinclair/typebox").TEnum<typeof PROTO.CardanoDRepType>;
|
|
200
|
+
keyHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
201
|
+
scriptHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
202
|
+
}>;
|
|
197
203
|
export type CardanoCertificate = Static<typeof CardanoCertificate>;
|
|
198
204
|
export declare const CardanoCertificate: import("@sinclair/typebox").TObject<{
|
|
199
205
|
type: import("@sinclair/typebox").TEnum<typeof PROTO.CardanoCertificateType>;
|
|
@@ -227,6 +233,12 @@ export declare const CardanoCertificate: import("@sinclair/typebox").TObject<{
|
|
|
227
233
|
}>>;
|
|
228
234
|
scriptHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
229
235
|
keyHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
236
|
+
deposit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
237
|
+
dRep: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
238
|
+
type: import("@sinclair/typebox").TEnum<typeof PROTO.CardanoDRepType>;
|
|
239
|
+
keyHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
240
|
+
scriptHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
241
|
+
}>>;
|
|
230
242
|
}>;
|
|
231
243
|
export type CardanoWithdrawal = Static<typeof CardanoWithdrawal>;
|
|
232
244
|
export declare const CardanoWithdrawal: import("@sinclair/typebox").TObject<{
|
|
@@ -392,6 +404,12 @@ export declare const CardanoSignTransaction: import("@sinclair/typebox").TObject
|
|
|
392
404
|
}>>;
|
|
393
405
|
scriptHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
394
406
|
keyHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
407
|
+
deposit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
408
|
+
dRep: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
409
|
+
type: import("@sinclair/typebox").TEnum<typeof PROTO.CardanoDRepType>;
|
|
410
|
+
keyHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
411
|
+
scriptHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
412
|
+
}>>;
|
|
395
413
|
}>>>;
|
|
396
414
|
withdrawals: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
397
415
|
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>>;
|
|
@@ -489,6 +507,7 @@ export declare const CardanoSignTransaction: import("@sinclair/typebox").TObject
|
|
|
489
507
|
derivationType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<typeof PROTO.CardanoDerivationType>>;
|
|
490
508
|
includeNetworkId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
491
509
|
chunkify: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
510
|
+
tagCborSets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
492
511
|
}>;
|
|
493
512
|
export type CardanoSignTransactionExtended = Static<typeof CardanoSignTransactionExtended>;
|
|
494
513
|
export declare const CardanoSignTransactionExtended: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
@@ -562,6 +581,12 @@ export declare const CardanoSignTransactionExtended: import("@sinclair/typebox")
|
|
|
562
581
|
}>>;
|
|
563
582
|
scriptHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
564
583
|
keyHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
584
|
+
deposit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
585
|
+
dRep: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
586
|
+
type: import("@sinclair/typebox").TEnum<typeof PROTO.CardanoDRepType>;
|
|
587
|
+
keyHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
588
|
+
scriptHash: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
589
|
+
}>>;
|
|
565
590
|
}>>>;
|
|
566
591
|
withdrawals: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
567
592
|
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>>;
|
|
@@ -659,6 +684,7 @@ export declare const CardanoSignTransactionExtended: import("@sinclair/typebox")
|
|
|
659
684
|
derivationType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<typeof PROTO.CardanoDerivationType>>;
|
|
660
685
|
includeNetworkId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
661
686
|
chunkify: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
687
|
+
tagCborSets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
662
688
|
}>, import("@sinclair/typebox").TObject<{
|
|
663
689
|
unsignedTx: import("@sinclair/typebox").TObject<{
|
|
664
690
|
body: import("@sinclair/typebox").TString;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CardanoSignedTxData = exports.CardanoAuxiliaryDataSupplement = exports.CardanoSignedTxWitness = exports.CardanoSignTransactionExtended = exports.CardanoSignTransaction = exports.CardanoAuxiliaryData = exports.CardanoCVoteRegistrationParameters = exports.CardanoCVoteRegistrationDelegation = exports.CardanoReferenceInput = exports.CardanoRequiredSigner = exports.CardanoCollateralInput = exports.CardanoMint = exports.CardanoWithdrawal = exports.CardanoCertificate = exports.CardanoPoolParameters = exports.CardanoPoolMargin = exports.CardanoPoolMetadata = exports.CardanoPoolRelay = exports.CardanoPoolOwner = exports.CardanoOutput = exports.CardanoAssetGroup = exports.CardanoToken = exports.CardanoInput = exports.CardanoGetPublicKey = exports.CardanoNativeScriptHash = exports.CardanoGetNativeScriptHash = exports.CardanoNativeScript = exports.CardanoGetAddress = exports.CardanoAddressParameters = exports.CardanoCertificatePointer = void 0;
|
|
3
|
+
exports.CardanoSignedTxData = exports.CardanoAuxiliaryDataSupplement = exports.CardanoSignedTxWitness = exports.CardanoSignTransactionExtended = exports.CardanoSignTransaction = exports.CardanoAuxiliaryData = exports.CardanoCVoteRegistrationParameters = exports.CardanoCVoteRegistrationDelegation = exports.CardanoReferenceInput = exports.CardanoRequiredSigner = exports.CardanoCollateralInput = exports.CardanoMint = exports.CardanoWithdrawal = exports.CardanoCertificate = exports.CardanoDRep = exports.CardanoPoolParameters = exports.CardanoPoolMargin = exports.CardanoPoolMetadata = exports.CardanoPoolRelay = exports.CardanoPoolOwner = exports.CardanoOutput = exports.CardanoAssetGroup = exports.CardanoToken = exports.CardanoInput = exports.CardanoGetPublicKey = exports.CardanoNativeScriptHash = exports.CardanoGetNativeScriptHash = exports.CardanoNativeScript = exports.CardanoGetAddress = exports.CardanoAddressParameters = exports.CardanoCertificatePointer = void 0;
|
|
4
4
|
const schema_utils_1 = require("@trezor/schema-utils");
|
|
5
5
|
const constants_1 = require("../../../constants");
|
|
6
6
|
const params_1 = require("../../params");
|
|
@@ -112,6 +112,11 @@ exports.CardanoPoolParameters = schema_utils_1.Type.Object({
|
|
|
112
112
|
relays: schema_utils_1.Type.Array(exports.CardanoPoolRelay),
|
|
113
113
|
metadata: schema_utils_1.Type.Optional(exports.CardanoPoolMetadata),
|
|
114
114
|
});
|
|
115
|
+
exports.CardanoDRep = schema_utils_1.Type.Object({
|
|
116
|
+
type: constants_1.PROTO.EnumCardanoDRepType,
|
|
117
|
+
keyHash: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
118
|
+
scriptHash: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
119
|
+
});
|
|
115
120
|
exports.CardanoCertificate = schema_utils_1.Type.Object({
|
|
116
121
|
type: constants_1.PROTO.EnumCardanoCertificateType,
|
|
117
122
|
path: schema_utils_1.Type.Optional(params_1.DerivationPath),
|
|
@@ -119,6 +124,8 @@ exports.CardanoCertificate = schema_utils_1.Type.Object({
|
|
|
119
124
|
poolParameters: schema_utils_1.Type.Optional(exports.CardanoPoolParameters),
|
|
120
125
|
scriptHash: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
121
126
|
keyHash: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
127
|
+
deposit: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
128
|
+
dRep: schema_utils_1.Type.Optional(exports.CardanoDRep),
|
|
122
129
|
});
|
|
123
130
|
exports.CardanoWithdrawal = schema_utils_1.Type.Object({
|
|
124
131
|
path: schema_utils_1.Type.Optional(params_1.DerivationPath),
|
|
@@ -181,6 +188,7 @@ exports.CardanoSignTransaction = schema_utils_1.Type.Object({
|
|
|
181
188
|
derivationType: schema_utils_1.Type.Optional(constants_1.PROTO.EnumCardanoDerivationType),
|
|
182
189
|
includeNetworkId: schema_utils_1.Type.Optional(schema_utils_1.Type.Boolean()),
|
|
183
190
|
chunkify: schema_utils_1.Type.Optional(schema_utils_1.Type.Boolean()),
|
|
191
|
+
tagCborSets: schema_utils_1.Type.Optional(schema_utils_1.Type.Boolean()),
|
|
184
192
|
});
|
|
185
193
|
exports.CardanoSignTransactionExtended = schema_utils_1.Type.Intersect([
|
|
186
194
|
exports.CardanoSignTransaction,
|
package/lib/types/api/index.d.ts
CHANGED
|
@@ -18,14 +18,16 @@ import { blockchainSubscribeFiatRates } from './blockchainSubscribeFiatRates';
|
|
|
18
18
|
import { blockchainUnsubscribe } from './blockchainUnsubscribe';
|
|
19
19
|
import { blockchainUnsubscribeFiatRates } from './blockchainUnsubscribeFiatRates';
|
|
20
20
|
import { cancel } from './cancel';
|
|
21
|
+
import { cancelCoinjoinAuthorization } from './cancelCoinjoinAuthorization';
|
|
22
|
+
import { cardanoComposeTransaction } from './cardanoComposeTransaction';
|
|
21
23
|
import { cardanoGetAddress } from './cardanoGetAddress';
|
|
22
24
|
import { cardanoGetNativeScriptHash } from './cardanoGetNativeScriptHash';
|
|
23
25
|
import { cardanoGetPublicKey } from './cardanoGetPublicKey';
|
|
24
26
|
import { cardanoSignTransaction } from './cardanoSignTransaction';
|
|
25
|
-
import { cardanoComposeTransaction } from './cardanoComposeTransaction';
|
|
26
27
|
import { changeLanguage } from './changeLanguage';
|
|
27
28
|
import { changePin } from './changePin';
|
|
28
29
|
import { changeWipeCode } from './changeWipeCode';
|
|
30
|
+
import { checkFirmwareAuthenticity } from './checkFirmwareAuthenticity';
|
|
29
31
|
import { cipherKeyValue } from './cipherKeyValue';
|
|
30
32
|
import { composeTransaction } from './composeTransaction';
|
|
31
33
|
import { disableWebUSB } from './disableWebUSB';
|
|
@@ -66,12 +68,14 @@ import { requestWebUSBDevice } from './requestWebUSBDevice';
|
|
|
66
68
|
import { resetDevice } from './resetDevice';
|
|
67
69
|
import { rippleGetAddress } from './rippleGetAddress';
|
|
68
70
|
import { rippleSignTransaction } from './rippleSignTransaction';
|
|
71
|
+
import { setBrightness } from './setBrightness';
|
|
69
72
|
import { setBusy } from './setBusy';
|
|
70
73
|
import { setProxy } from './setProxy';
|
|
74
|
+
import { showDeviceTutorial } from './showDeviceTutorial';
|
|
71
75
|
import { signMessage } from './signMessage';
|
|
72
76
|
import { signTransaction } from './signTransaction';
|
|
73
|
-
import { solanaGetPublicKey } from './solanaGetPublicKey';
|
|
74
77
|
import { solanaGetAddress } from './solanaGetAddress';
|
|
78
|
+
import { solanaGetPublicKey } from './solanaGetPublicKey';
|
|
75
79
|
import { solanaSignTransaction } from './solanaSignTransaction';
|
|
76
80
|
import { stellarGetAddress } from './stellarGetAddress';
|
|
77
81
|
import { stellarSignTransaction } from './stellarSignTransaction';
|
|
@@ -82,9 +86,6 @@ import { uiResponse } from './uiResponse';
|
|
|
82
86
|
import { unlockPath } from './unlockPath';
|
|
83
87
|
import { verifyMessage } from './verifyMessage';
|
|
84
88
|
import { wipeDevice } from './wipeDevice';
|
|
85
|
-
import { checkFirmwareAuthenticity } from './checkFirmwareAuthenticity';
|
|
86
|
-
import { cancelCoinjoinAuthorization } from './cancelCoinjoinAuthorization';
|
|
87
|
-
import { showDeviceTutorial } from './showDeviceTutorial';
|
|
88
89
|
export interface TrezorConnect {
|
|
89
90
|
applyFlags: typeof applyFlags;
|
|
90
91
|
applySettings: typeof applySettings;
|
|
@@ -156,6 +157,7 @@ export interface TrezorConnect {
|
|
|
156
157
|
resetDevice: typeof resetDevice;
|
|
157
158
|
rippleGetAddress: typeof rippleGetAddress;
|
|
158
159
|
rippleSignTransaction: typeof rippleSignTransaction;
|
|
160
|
+
setBrightness: typeof setBrightness;
|
|
159
161
|
setBusy: typeof setBusy;
|
|
160
162
|
setProxy: typeof setProxy;
|
|
161
163
|
signMessage: typeof signMessage;
|
|
@@ -5,13 +5,13 @@ export type RecoveryDevice = Static<typeof RecoveryDevice>;
|
|
|
5
5
|
export declare const RecoveryDevice: import("@sinclair/typebox").TObject<{
|
|
6
6
|
language: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
7
7
|
label: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
|
-
type: import("@sinclair/typebox").TOptional<import("@
|
|
8
|
+
type: import("@sinclair/typebox").TOptional<import("@trezor/schema-utils/lib/custom-types/keyof-enum").TKeyOfEnum<typeof PROTO.Enum_RecoveryType>>;
|
|
9
9
|
pin_protection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
10
10
|
passphrase_protection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
11
11
|
word_count: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<12>, import("@sinclair/typebox").TLiteral<18>, import("@sinclair/typebox").TLiteral<24>]>]>>;
|
|
12
12
|
enforce_wordlist: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
13
|
+
input_method: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<typeof PROTO.RecoveryDeviceInputMethod>>;
|
|
13
14
|
u2f_counter: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
14
|
-
dry_run: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
15
15
|
}>;
|
|
16
16
|
export declare function recoveryDevice(params: Params<RecoveryDevice>): Response<PROTO.Success>;
|
|
17
17
|
//# sourceMappingURL=recoveryDevice.d.ts.map
|