@onekeyfe/hwk-trezor-adapter 1.2.8-alpha.12 → 1.2.8-alpha.13
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.mts +70 -25
- package/dist/index.d.ts +70 -25
- package/dist/index.js +1167 -234
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1154 -221
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IHardwareWallet, IConnector, TransportType, DeviceInfo,
|
|
1
|
+
import { IHardwareWallet, IConnector, TransportType, SearchDevicesOptions, DeviceInfo, DeviceSearchTarget, BindBleDeviceParams, Response, AllNetworkGetAddressParams, AllNetworkAddressResponse, IDeviceManagerOperationContext, DeviceAuthenticityParams, DeviceAuthenticityResult, TrezorDeviceSettingsParams, TrezorBrightnessParams, TrezorChangePinParams, UiResponseEvent, ChainForFingerprint, ICommonCallParams, EvmGetAddressParams, EvmAddress, EvmSignTxTrezorParams, EvmSignedTx, EvmSignMsgParams, EvmSignature, EvmSignTypedDataParams, BtcGetAddressParams, BtcAddress, BtcGetPublicKeyParams, BtcPublicKey, BtcSignTxParams, BtcSignedTx, BtcSignPsbtParams, BtcSignedPsbt, BtcSignMsgParams, BtcSignature, SolGetAddressParams, SolAddress, SolSignTxParams, SolSignedTx, SolSignMsgParams, SolSignature, TronGetAddressParams, TronAddress, TronSignTxParams, TronSignedTx, TronSignMsgParams, TronSignature, HardwareEventMap, DeviceEventListener, EvmEthereumDefinitions, ConnectorDevice } from '@onekeyfe/hwk-adapter-core';
|
|
2
2
|
|
|
3
3
|
type TrezorPassphraseCallParams = {
|
|
4
4
|
passphraseState?: string;
|
|
@@ -6,10 +6,21 @@ type TrezorPassphraseCallParams = {
|
|
|
6
6
|
};
|
|
7
7
|
type TrezorCallParams<T> = (T & ICommonCallParams & TrezorPassphraseCallParams) | null | undefined;
|
|
8
8
|
type TrezorCommonParams = (ICommonCallParams & TrezorPassphraseCallParams) | null | undefined;
|
|
9
|
+
interface TrezorKnownDeviceConnection {
|
|
10
|
+
deviceId: string;
|
|
11
|
+
usbConnectId?: string;
|
|
12
|
+
bleConnectId?: string;
|
|
13
|
+
}
|
|
14
|
+
interface TrezorAdapterOptions {
|
|
15
|
+
/** Persisted endpoints are routing hints, never proof of device identity. */
|
|
16
|
+
knownDeviceConnections?: readonly TrezorKnownDeviceConnection[];
|
|
17
|
+
}
|
|
9
18
|
declare class TrezorAdapter implements IHardwareWallet {
|
|
10
19
|
readonly vendor: "trezor";
|
|
20
|
+
readonly cancelCapability: "stops-waiting";
|
|
11
21
|
private readonly _connector;
|
|
12
22
|
private readonly _emitter;
|
|
23
|
+
private readonly _operations;
|
|
13
24
|
private readonly _devices;
|
|
14
25
|
private readonly _sessions;
|
|
15
26
|
private readonly _connectingPromises;
|
|
@@ -17,8 +28,16 @@ declare class TrezorAdapter implements IHardwareWallet {
|
|
|
17
28
|
private readonly _uiRegistry;
|
|
18
29
|
private readonly _passphraseRequestContextByConnectId;
|
|
19
30
|
private readonly _verifiedPassphraseSessionsByConnectId;
|
|
31
|
+
/** Raw connector calls that outlive an aborted caller, keyed by session. */
|
|
32
|
+
private readonly _unsettledConnectorOperations;
|
|
33
|
+
private readonly _connectorIdleWaiters;
|
|
34
|
+
private _resetPromise;
|
|
35
|
+
private _connectorTeardownTail;
|
|
36
|
+
private _pendingConnectorTeardowns;
|
|
37
|
+
private _stateGeneration;
|
|
20
38
|
private readonly _jobQueue;
|
|
21
|
-
|
|
39
|
+
private readonly _knownDeviceConnections;
|
|
40
|
+
constructor(connector: IConnector, options?: TrezorAdapterOptions);
|
|
22
41
|
private static _createDeviceBusyError;
|
|
23
42
|
/**
|
|
24
43
|
* Split a Trezor-only `passphraseState` routing hint off the chain params so
|
|
@@ -41,19 +60,17 @@ declare class TrezorAdapter implements IHardwareWallet {
|
|
|
41
60
|
* selected is gone (the device evicted it from its limited slot pool). The
|
|
42
61
|
* caller drops the stale cache entry and recreates from scratch.
|
|
43
62
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* (which would silently re-prompt the passphrase).
|
|
63
|
+
* Match only the protocol's explicit unallocated-channel code. Guessing from
|
|
64
|
+
* an error message could replay a request after an unrelated business error.
|
|
47
65
|
*/
|
|
48
66
|
private static _isStaleSessionError;
|
|
49
67
|
private static _errorCode;
|
|
50
68
|
private static _isConnectionUnavailableError;
|
|
51
69
|
private static _isRecoverableProtocolResidueError;
|
|
52
70
|
/**
|
|
53
|
-
* Race a promise against an abort signal.
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* uselessly in the background.
|
|
71
|
+
* Race a promise against an abort signal. IConnector.call() can't actually
|
|
72
|
+
* be cancelled at the protocol level, so the caller gets the abort while the
|
|
73
|
+
* adapter keeps the transport exclusively reserved until the raw call drains.
|
|
57
74
|
*/
|
|
58
75
|
private static _abortable;
|
|
59
76
|
private _connectSession;
|
|
@@ -66,17 +83,24 @@ declare class TrezorAdapter implements IHardwareWallet {
|
|
|
66
83
|
* error flows. Aborts active jobs and releases UI waits.
|
|
67
84
|
*/
|
|
68
85
|
resetState(): void;
|
|
86
|
+
private _resetStateAndDisconnectSessions;
|
|
69
87
|
getAvailableTransports(): TransportType[];
|
|
70
88
|
switchTransport(_type: TransportType): Promise<void>;
|
|
71
|
-
searchDevices(options?:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
89
|
+
searchDevices(options?: SearchDevicesOptions): Promise<DeviceInfo[]>;
|
|
90
|
+
private _searchDevices;
|
|
91
|
+
searchDeviceTargets(options?: SearchDevicesOptions): Promise<DeviceSearchTarget[]>;
|
|
92
|
+
bindBleDevice(params: BindBleDeviceParams): Promise<Response<string>>;
|
|
93
|
+
connectDevice(searchTargetId: string): Promise<Response<string>>;
|
|
94
|
+
releaseOperation(operationId: string): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Ends a released operation's calls and prompts before teardown, which otherwise waits on a call
|
|
97
|
+
* that waits on a prompt nobody will answer. Device I/O already on the wire still drains.
|
|
98
|
+
*/
|
|
99
|
+
private _cancelOperationWork;
|
|
100
|
+
private _releaseOperationConnection;
|
|
101
|
+
getDeviceInfo(connectIdOrOperationId: string, deviceId: string): Promise<Response<DeviceInfo>>;
|
|
78
102
|
allNetworkGetAddress(connectId: string, deviceId: string, params: AllNetworkGetAddressParams): Promise<Response<AllNetworkAddressResponse[]>>;
|
|
79
|
-
getFeatures(connectId: string): Promise<Response<Record<string, unknown>>>;
|
|
103
|
+
getFeatures(connectId: string, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
|
|
80
104
|
/**
|
|
81
105
|
* Device authenticity attestation. Sends a host-generated challenge, has the
|
|
82
106
|
* device sign it with its secure-element key, then verifies the returned
|
|
@@ -92,12 +116,17 @@ declare class TrezorAdapter implements IHardwareWallet {
|
|
|
92
116
|
* enable it in a production accounting flow, it lets an emulator mint any id.
|
|
93
117
|
*/
|
|
94
118
|
verifyDeviceAuthenticity(connectId: string, params?: DeviceAuthenticityParams): Promise<Response<DeviceAuthenticityResult>>;
|
|
95
|
-
deviceSettings(connectId: string, params: TrezorDeviceSettingsParams): Promise<Response<Record<string, unknown>>>;
|
|
96
|
-
setBrightness(connectId: string, params?: TrezorBrightnessParams): Promise<Response<Record<string, unknown>>>;
|
|
97
|
-
changePin(connectId: string, params?: TrezorChangePinParams): Promise<Response<Record<string, unknown>>>;
|
|
98
|
-
wipeDevice(connectId: string): Promise<Response<Record<string, unknown>>>;
|
|
119
|
+
deviceSettings(connectId: string, params: TrezorDeviceSettingsParams, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
|
|
120
|
+
setBrightness(connectId: string, params?: TrezorBrightnessParams, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
|
|
121
|
+
changePin(connectId: string, params?: TrezorChangePinParams, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
|
|
122
|
+
wipeDevice(connectId: string, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
|
|
99
123
|
private _getTrezorDeviceId;
|
|
100
124
|
cancel(connectId?: string): void;
|
|
125
|
+
/**
|
|
126
|
+
* Operation owning the running job: its queue key when pinned, else the live
|
|
127
|
+
* operation of its connectId, so a mid-call UI request can name it.
|
|
128
|
+
*/
|
|
129
|
+
private _activeOperationId;
|
|
101
130
|
/**
|
|
102
131
|
* Routes to BOTH the adapter's local UI registry (preemption decisions,
|
|
103
132
|
* future SELECT_DEVICE / DEVICE_PERMISSION) AND the connector's registry
|
|
@@ -114,7 +143,7 @@ declare class TrezorAdapter implements IHardwareWallet {
|
|
|
114
143
|
* Unlike Ledger (which hashes a per-chain address), it is chain-global, so
|
|
115
144
|
* `chain` is accepted for API parity but ignored.
|
|
116
145
|
*/
|
|
117
|
-
getChainFingerprint(connectId: string,
|
|
146
|
+
getChainFingerprint(connectId: string, deviceId: string, _chain: ChainForFingerprint): Promise<Response<string>>;
|
|
118
147
|
/**
|
|
119
148
|
* Resolve the active passphrase wallet identity (`passphraseState`).
|
|
120
149
|
* See {@link IHardwareWallet.getPassphraseState} for the discover/verify
|
|
@@ -123,7 +152,7 @@ declare class TrezorAdapter implements IHardwareWallet {
|
|
|
123
152
|
* can't interleave with a chain call on the same device (which would desync
|
|
124
153
|
* the THP session selection).
|
|
125
154
|
*/
|
|
126
|
-
getPassphraseState(connectId: string, passphraseState?: string): Promise<Response<string | null>>;
|
|
155
|
+
getPassphraseState(connectId: string, passphraseState?: string, operationContext?: IDeviceManagerOperationContext): Promise<Response<string | null>>;
|
|
127
156
|
evmGetAddress(connectId?: string | null, deviceId?: string | null, params?: TrezorCallParams<EvmGetAddressParams>): Promise<Response<EvmAddress>>;
|
|
128
157
|
evmSignTransaction(connectId?: string | null, deviceId?: string | null, params?: TrezorCallParams<EvmSignTxTrezorParams>): Promise<Response<EvmSignedTx>>;
|
|
129
158
|
evmSignMessage(connectId?: string | null, deviceId?: string | null, params?: TrezorCallParams<EvmSignMsgParams>): Promise<Response<EvmSignature>>;
|
|
@@ -143,7 +172,16 @@ declare class TrezorAdapter implements IHardwareWallet {
|
|
|
143
172
|
tronSignTransaction(connectId?: string | null, deviceId?: string | null, params?: TrezorCallParams<TronSignTxParams>): Promise<Response<TronSignedTx>>;
|
|
144
173
|
tronSignMessage(connectId?: string | null, deviceId?: string | null, params?: TrezorCallParams<TronSignMsgParams>): Promise<Response<TronSignature>>;
|
|
145
174
|
private static _unwrapConnectorResult;
|
|
146
|
-
private
|
|
175
|
+
private _callConnector;
|
|
176
|
+
private _assertConnectorIdle;
|
|
177
|
+
private _runConnectorTeardown;
|
|
178
|
+
private _disconnectSession;
|
|
179
|
+
private _availableTransports;
|
|
180
|
+
/** Transports the connector offers and the host's model table allows; discovery opens no other. */
|
|
181
|
+
private _allowedTransports;
|
|
182
|
+
private _releaseProvisionalConnection;
|
|
183
|
+
private _waitForConnectorOperationsToDrain;
|
|
184
|
+
private _retainConnectorOperation;
|
|
147
185
|
private static _normalizeAllNetworkItem;
|
|
148
186
|
private static _getItemDeviceId;
|
|
149
187
|
private _callAllNetworkMethod;
|
|
@@ -156,6 +194,13 @@ declare class TrezorAdapter implements IHardwareWallet {
|
|
|
156
194
|
private _callMethod;
|
|
157
195
|
private _callWithRetry;
|
|
158
196
|
private _ensureSession;
|
|
197
|
+
/** An identity probe tears down only a session it opened; another caller's stays up. */
|
|
198
|
+
private _hasSessionOrConnect;
|
|
199
|
+
private _resolveExpectedDeviceConnectId;
|
|
200
|
+
private _selectBleDeviceForBinding;
|
|
201
|
+
private _emitBindingStatus;
|
|
202
|
+
private _rememberVerifiedConnection;
|
|
203
|
+
private _emitVerifiedBinding;
|
|
159
204
|
/**
|
|
160
205
|
* Pin the device's active wallet session to `passphraseState` (the target
|
|
161
206
|
* wallet identity) before a wallet-bound op. THP has an app-session id; v1
|
|
@@ -413,4 +458,4 @@ declare function isTrezorBleServiceUuid(uuid: string): boolean;
|
|
|
413
458
|
declare function isTrezorBleDescriptor(descriptor: TrezorBleDescriptor): boolean;
|
|
414
459
|
declare function resolveTrezorBleConnectId(descriptor: TrezorBleDescriptor): string;
|
|
415
460
|
|
|
416
|
-
export { type AuthenticateDeviceResult, type AuthenticityProof, type BuildEthereumDefinitionsForPathParams, type BuildEthereumDefinitionsForSignTxParams, DEFAULT_ETHEREUM_DEFINITIONS_BASE_URL, DEFAULT_SOLANA_TOKEN_DEFINITION_BASE_URL, type FetchEthereumDefinitionsParams, type FetchLike, type FetchSolanaTokenDefinitionParams, type SdkEvent, type SdkEventListener, type SdkLogEvent, TREZOR_BLE_PACKET_SIZE, TREZOR_BLE_SUPPORTED_MODELS, TREZOR_BLE_UUIDS, TREZOR_SAFE_7_MODEL, TrezorAdapter, type TrezorBleDescriptor, type TrezorBleTransport, type TrezorBleTransportFactory, type TrezorConnectedDevice, type TrezorConnectorDevice, authenticateDeviceFromProof, buildEthereumDefinitionsForPath, buildEthereumDefinitionsForSignTx, fetchEthereumDefinitions, fetchSolanaTokenDefinition, getRequiredDeviceAuthenticityLayers, getSlip44FromPath, isTrezorBleDescriptor, isTrezorBleServiceUuid, isTrezorBleSupportedModel, isTrezorSafe7BleDescriptor, isTrezorSafe7BleName, normalizeTrezorBleUuid, offSdkEvent, onSdkEvent, resolveTrezorBleConnectId };
|
|
461
|
+
export { type AuthenticateDeviceResult, type AuthenticityProof, type BuildEthereumDefinitionsForPathParams, type BuildEthereumDefinitionsForSignTxParams, DEFAULT_ETHEREUM_DEFINITIONS_BASE_URL, DEFAULT_SOLANA_TOKEN_DEFINITION_BASE_URL, type FetchEthereumDefinitionsParams, type FetchLike, type FetchSolanaTokenDefinitionParams, type SdkEvent, type SdkEventListener, type SdkLogEvent, TREZOR_BLE_PACKET_SIZE, TREZOR_BLE_SUPPORTED_MODELS, TREZOR_BLE_UUIDS, TREZOR_SAFE_7_MODEL, TrezorAdapter, type TrezorAdapterOptions, type TrezorBleDescriptor, type TrezorBleTransport, type TrezorBleTransportFactory, type TrezorConnectedDevice, type TrezorConnectorDevice, type TrezorKnownDeviceConnection, authenticateDeviceFromProof, buildEthereumDefinitionsForPath, buildEthereumDefinitionsForSignTx, fetchEthereumDefinitions, fetchSolanaTokenDefinition, getRequiredDeviceAuthenticityLayers, getSlip44FromPath, isTrezorBleDescriptor, isTrezorBleServiceUuid, isTrezorBleSupportedModel, isTrezorSafe7BleDescriptor, isTrezorSafe7BleName, normalizeTrezorBleUuid, offSdkEvent, onSdkEvent, resolveTrezorBleConnectId };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IHardwareWallet, IConnector, TransportType, DeviceInfo,
|
|
1
|
+
import { IHardwareWallet, IConnector, TransportType, SearchDevicesOptions, DeviceInfo, DeviceSearchTarget, BindBleDeviceParams, Response, AllNetworkGetAddressParams, AllNetworkAddressResponse, IDeviceManagerOperationContext, DeviceAuthenticityParams, DeviceAuthenticityResult, TrezorDeviceSettingsParams, TrezorBrightnessParams, TrezorChangePinParams, UiResponseEvent, ChainForFingerprint, ICommonCallParams, EvmGetAddressParams, EvmAddress, EvmSignTxTrezorParams, EvmSignedTx, EvmSignMsgParams, EvmSignature, EvmSignTypedDataParams, BtcGetAddressParams, BtcAddress, BtcGetPublicKeyParams, BtcPublicKey, BtcSignTxParams, BtcSignedTx, BtcSignPsbtParams, BtcSignedPsbt, BtcSignMsgParams, BtcSignature, SolGetAddressParams, SolAddress, SolSignTxParams, SolSignedTx, SolSignMsgParams, SolSignature, TronGetAddressParams, TronAddress, TronSignTxParams, TronSignedTx, TronSignMsgParams, TronSignature, HardwareEventMap, DeviceEventListener, EvmEthereumDefinitions, ConnectorDevice } from '@onekeyfe/hwk-adapter-core';
|
|
2
2
|
|
|
3
3
|
type TrezorPassphraseCallParams = {
|
|
4
4
|
passphraseState?: string;
|
|
@@ -6,10 +6,21 @@ type TrezorPassphraseCallParams = {
|
|
|
6
6
|
};
|
|
7
7
|
type TrezorCallParams<T> = (T & ICommonCallParams & TrezorPassphraseCallParams) | null | undefined;
|
|
8
8
|
type TrezorCommonParams = (ICommonCallParams & TrezorPassphraseCallParams) | null | undefined;
|
|
9
|
+
interface TrezorKnownDeviceConnection {
|
|
10
|
+
deviceId: string;
|
|
11
|
+
usbConnectId?: string;
|
|
12
|
+
bleConnectId?: string;
|
|
13
|
+
}
|
|
14
|
+
interface TrezorAdapterOptions {
|
|
15
|
+
/** Persisted endpoints are routing hints, never proof of device identity. */
|
|
16
|
+
knownDeviceConnections?: readonly TrezorKnownDeviceConnection[];
|
|
17
|
+
}
|
|
9
18
|
declare class TrezorAdapter implements IHardwareWallet {
|
|
10
19
|
readonly vendor: "trezor";
|
|
20
|
+
readonly cancelCapability: "stops-waiting";
|
|
11
21
|
private readonly _connector;
|
|
12
22
|
private readonly _emitter;
|
|
23
|
+
private readonly _operations;
|
|
13
24
|
private readonly _devices;
|
|
14
25
|
private readonly _sessions;
|
|
15
26
|
private readonly _connectingPromises;
|
|
@@ -17,8 +28,16 @@ declare class TrezorAdapter implements IHardwareWallet {
|
|
|
17
28
|
private readonly _uiRegistry;
|
|
18
29
|
private readonly _passphraseRequestContextByConnectId;
|
|
19
30
|
private readonly _verifiedPassphraseSessionsByConnectId;
|
|
31
|
+
/** Raw connector calls that outlive an aborted caller, keyed by session. */
|
|
32
|
+
private readonly _unsettledConnectorOperations;
|
|
33
|
+
private readonly _connectorIdleWaiters;
|
|
34
|
+
private _resetPromise;
|
|
35
|
+
private _connectorTeardownTail;
|
|
36
|
+
private _pendingConnectorTeardowns;
|
|
37
|
+
private _stateGeneration;
|
|
20
38
|
private readonly _jobQueue;
|
|
21
|
-
|
|
39
|
+
private readonly _knownDeviceConnections;
|
|
40
|
+
constructor(connector: IConnector, options?: TrezorAdapterOptions);
|
|
22
41
|
private static _createDeviceBusyError;
|
|
23
42
|
/**
|
|
24
43
|
* Split a Trezor-only `passphraseState` routing hint off the chain params so
|
|
@@ -41,19 +60,17 @@ declare class TrezorAdapter implements IHardwareWallet {
|
|
|
41
60
|
* selected is gone (the device evicted it from its limited slot pool). The
|
|
42
61
|
* caller drops the stale cache entry and recreates from scratch.
|
|
43
62
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* (which would silently re-prompt the passphrase).
|
|
63
|
+
* Match only the protocol's explicit unallocated-channel code. Guessing from
|
|
64
|
+
* an error message could replay a request after an unrelated business error.
|
|
47
65
|
*/
|
|
48
66
|
private static _isStaleSessionError;
|
|
49
67
|
private static _errorCode;
|
|
50
68
|
private static _isConnectionUnavailableError;
|
|
51
69
|
private static _isRecoverableProtocolResidueError;
|
|
52
70
|
/**
|
|
53
|
-
* Race a promise against an abort signal.
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* uselessly in the background.
|
|
71
|
+
* Race a promise against an abort signal. IConnector.call() can't actually
|
|
72
|
+
* be cancelled at the protocol level, so the caller gets the abort while the
|
|
73
|
+
* adapter keeps the transport exclusively reserved until the raw call drains.
|
|
57
74
|
*/
|
|
58
75
|
private static _abortable;
|
|
59
76
|
private _connectSession;
|
|
@@ -66,17 +83,24 @@ declare class TrezorAdapter implements IHardwareWallet {
|
|
|
66
83
|
* error flows. Aborts active jobs and releases UI waits.
|
|
67
84
|
*/
|
|
68
85
|
resetState(): void;
|
|
86
|
+
private _resetStateAndDisconnectSessions;
|
|
69
87
|
getAvailableTransports(): TransportType[];
|
|
70
88
|
switchTransport(_type: TransportType): Promise<void>;
|
|
71
|
-
searchDevices(options?:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
89
|
+
searchDevices(options?: SearchDevicesOptions): Promise<DeviceInfo[]>;
|
|
90
|
+
private _searchDevices;
|
|
91
|
+
searchDeviceTargets(options?: SearchDevicesOptions): Promise<DeviceSearchTarget[]>;
|
|
92
|
+
bindBleDevice(params: BindBleDeviceParams): Promise<Response<string>>;
|
|
93
|
+
connectDevice(searchTargetId: string): Promise<Response<string>>;
|
|
94
|
+
releaseOperation(operationId: string): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Ends a released operation's calls and prompts before teardown, which otherwise waits on a call
|
|
97
|
+
* that waits on a prompt nobody will answer. Device I/O already on the wire still drains.
|
|
98
|
+
*/
|
|
99
|
+
private _cancelOperationWork;
|
|
100
|
+
private _releaseOperationConnection;
|
|
101
|
+
getDeviceInfo(connectIdOrOperationId: string, deviceId: string): Promise<Response<DeviceInfo>>;
|
|
78
102
|
allNetworkGetAddress(connectId: string, deviceId: string, params: AllNetworkGetAddressParams): Promise<Response<AllNetworkAddressResponse[]>>;
|
|
79
|
-
getFeatures(connectId: string): Promise<Response<Record<string, unknown>>>;
|
|
103
|
+
getFeatures(connectId: string, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
|
|
80
104
|
/**
|
|
81
105
|
* Device authenticity attestation. Sends a host-generated challenge, has the
|
|
82
106
|
* device sign it with its secure-element key, then verifies the returned
|
|
@@ -92,12 +116,17 @@ declare class TrezorAdapter implements IHardwareWallet {
|
|
|
92
116
|
* enable it in a production accounting flow, it lets an emulator mint any id.
|
|
93
117
|
*/
|
|
94
118
|
verifyDeviceAuthenticity(connectId: string, params?: DeviceAuthenticityParams): Promise<Response<DeviceAuthenticityResult>>;
|
|
95
|
-
deviceSettings(connectId: string, params: TrezorDeviceSettingsParams): Promise<Response<Record<string, unknown>>>;
|
|
96
|
-
setBrightness(connectId: string, params?: TrezorBrightnessParams): Promise<Response<Record<string, unknown>>>;
|
|
97
|
-
changePin(connectId: string, params?: TrezorChangePinParams): Promise<Response<Record<string, unknown>>>;
|
|
98
|
-
wipeDevice(connectId: string): Promise<Response<Record<string, unknown>>>;
|
|
119
|
+
deviceSettings(connectId: string, params: TrezorDeviceSettingsParams, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
|
|
120
|
+
setBrightness(connectId: string, params?: TrezorBrightnessParams, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
|
|
121
|
+
changePin(connectId: string, params?: TrezorChangePinParams, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
|
|
122
|
+
wipeDevice(connectId: string, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
|
|
99
123
|
private _getTrezorDeviceId;
|
|
100
124
|
cancel(connectId?: string): void;
|
|
125
|
+
/**
|
|
126
|
+
* Operation owning the running job: its queue key when pinned, else the live
|
|
127
|
+
* operation of its connectId, so a mid-call UI request can name it.
|
|
128
|
+
*/
|
|
129
|
+
private _activeOperationId;
|
|
101
130
|
/**
|
|
102
131
|
* Routes to BOTH the adapter's local UI registry (preemption decisions,
|
|
103
132
|
* future SELECT_DEVICE / DEVICE_PERMISSION) AND the connector's registry
|
|
@@ -114,7 +143,7 @@ declare class TrezorAdapter implements IHardwareWallet {
|
|
|
114
143
|
* Unlike Ledger (which hashes a per-chain address), it is chain-global, so
|
|
115
144
|
* `chain` is accepted for API parity but ignored.
|
|
116
145
|
*/
|
|
117
|
-
getChainFingerprint(connectId: string,
|
|
146
|
+
getChainFingerprint(connectId: string, deviceId: string, _chain: ChainForFingerprint): Promise<Response<string>>;
|
|
118
147
|
/**
|
|
119
148
|
* Resolve the active passphrase wallet identity (`passphraseState`).
|
|
120
149
|
* See {@link IHardwareWallet.getPassphraseState} for the discover/verify
|
|
@@ -123,7 +152,7 @@ declare class TrezorAdapter implements IHardwareWallet {
|
|
|
123
152
|
* can't interleave with a chain call on the same device (which would desync
|
|
124
153
|
* the THP session selection).
|
|
125
154
|
*/
|
|
126
|
-
getPassphraseState(connectId: string, passphraseState?: string): Promise<Response<string | null>>;
|
|
155
|
+
getPassphraseState(connectId: string, passphraseState?: string, operationContext?: IDeviceManagerOperationContext): Promise<Response<string | null>>;
|
|
127
156
|
evmGetAddress(connectId?: string | null, deviceId?: string | null, params?: TrezorCallParams<EvmGetAddressParams>): Promise<Response<EvmAddress>>;
|
|
128
157
|
evmSignTransaction(connectId?: string | null, deviceId?: string | null, params?: TrezorCallParams<EvmSignTxTrezorParams>): Promise<Response<EvmSignedTx>>;
|
|
129
158
|
evmSignMessage(connectId?: string | null, deviceId?: string | null, params?: TrezorCallParams<EvmSignMsgParams>): Promise<Response<EvmSignature>>;
|
|
@@ -143,7 +172,16 @@ declare class TrezorAdapter implements IHardwareWallet {
|
|
|
143
172
|
tronSignTransaction(connectId?: string | null, deviceId?: string | null, params?: TrezorCallParams<TronSignTxParams>): Promise<Response<TronSignedTx>>;
|
|
144
173
|
tronSignMessage(connectId?: string | null, deviceId?: string | null, params?: TrezorCallParams<TronSignMsgParams>): Promise<Response<TronSignature>>;
|
|
145
174
|
private static _unwrapConnectorResult;
|
|
146
|
-
private
|
|
175
|
+
private _callConnector;
|
|
176
|
+
private _assertConnectorIdle;
|
|
177
|
+
private _runConnectorTeardown;
|
|
178
|
+
private _disconnectSession;
|
|
179
|
+
private _availableTransports;
|
|
180
|
+
/** Transports the connector offers and the host's model table allows; discovery opens no other. */
|
|
181
|
+
private _allowedTransports;
|
|
182
|
+
private _releaseProvisionalConnection;
|
|
183
|
+
private _waitForConnectorOperationsToDrain;
|
|
184
|
+
private _retainConnectorOperation;
|
|
147
185
|
private static _normalizeAllNetworkItem;
|
|
148
186
|
private static _getItemDeviceId;
|
|
149
187
|
private _callAllNetworkMethod;
|
|
@@ -156,6 +194,13 @@ declare class TrezorAdapter implements IHardwareWallet {
|
|
|
156
194
|
private _callMethod;
|
|
157
195
|
private _callWithRetry;
|
|
158
196
|
private _ensureSession;
|
|
197
|
+
/** An identity probe tears down only a session it opened; another caller's stays up. */
|
|
198
|
+
private _hasSessionOrConnect;
|
|
199
|
+
private _resolveExpectedDeviceConnectId;
|
|
200
|
+
private _selectBleDeviceForBinding;
|
|
201
|
+
private _emitBindingStatus;
|
|
202
|
+
private _rememberVerifiedConnection;
|
|
203
|
+
private _emitVerifiedBinding;
|
|
159
204
|
/**
|
|
160
205
|
* Pin the device's active wallet session to `passphraseState` (the target
|
|
161
206
|
* wallet identity) before a wallet-bound op. THP has an app-session id; v1
|
|
@@ -413,4 +458,4 @@ declare function isTrezorBleServiceUuid(uuid: string): boolean;
|
|
|
413
458
|
declare function isTrezorBleDescriptor(descriptor: TrezorBleDescriptor): boolean;
|
|
414
459
|
declare function resolveTrezorBleConnectId(descriptor: TrezorBleDescriptor): string;
|
|
415
460
|
|
|
416
|
-
export { type AuthenticateDeviceResult, type AuthenticityProof, type BuildEthereumDefinitionsForPathParams, type BuildEthereumDefinitionsForSignTxParams, DEFAULT_ETHEREUM_DEFINITIONS_BASE_URL, DEFAULT_SOLANA_TOKEN_DEFINITION_BASE_URL, type FetchEthereumDefinitionsParams, type FetchLike, type FetchSolanaTokenDefinitionParams, type SdkEvent, type SdkEventListener, type SdkLogEvent, TREZOR_BLE_PACKET_SIZE, TREZOR_BLE_SUPPORTED_MODELS, TREZOR_BLE_UUIDS, TREZOR_SAFE_7_MODEL, TrezorAdapter, type TrezorBleDescriptor, type TrezorBleTransport, type TrezorBleTransportFactory, type TrezorConnectedDevice, type TrezorConnectorDevice, authenticateDeviceFromProof, buildEthereumDefinitionsForPath, buildEthereumDefinitionsForSignTx, fetchEthereumDefinitions, fetchSolanaTokenDefinition, getRequiredDeviceAuthenticityLayers, getSlip44FromPath, isTrezorBleDescriptor, isTrezorBleServiceUuid, isTrezorBleSupportedModel, isTrezorSafe7BleDescriptor, isTrezorSafe7BleName, normalizeTrezorBleUuid, offSdkEvent, onSdkEvent, resolveTrezorBleConnectId };
|
|
461
|
+
export { type AuthenticateDeviceResult, type AuthenticityProof, type BuildEthereumDefinitionsForPathParams, type BuildEthereumDefinitionsForSignTxParams, DEFAULT_ETHEREUM_DEFINITIONS_BASE_URL, DEFAULT_SOLANA_TOKEN_DEFINITION_BASE_URL, type FetchEthereumDefinitionsParams, type FetchLike, type FetchSolanaTokenDefinitionParams, type SdkEvent, type SdkEventListener, type SdkLogEvent, TREZOR_BLE_PACKET_SIZE, TREZOR_BLE_SUPPORTED_MODELS, TREZOR_BLE_UUIDS, TREZOR_SAFE_7_MODEL, TrezorAdapter, type TrezorAdapterOptions, type TrezorBleDescriptor, type TrezorBleTransport, type TrezorBleTransportFactory, type TrezorConnectedDevice, type TrezorConnectorDevice, type TrezorKnownDeviceConnection, authenticateDeviceFromProof, buildEthereumDefinitionsForPath, buildEthereumDefinitionsForSignTx, fetchEthereumDefinitions, fetchSolanaTokenDefinition, getRequiredDeviceAuthenticityLayers, getSlip44FromPath, isTrezorBleDescriptor, isTrezorBleServiceUuid, isTrezorBleSupportedModel, isTrezorSafe7BleDescriptor, isTrezorSafe7BleName, normalizeTrezorBleUuid, offSdkEvent, onSdkEvent, resolveTrezorBleConnectId };
|