@onekeyfe/hwk-keystone-adapter 1.2.8-alpha.1 → 1.2.8-alpha.101
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 +41 -30
- package/dist/index.d.ts +41 -30
- package/dist/index.js +503 -492
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +505 -493
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChainCapability, DeviceInfo, IHardwareWallet, IConnector, TransportType, SearchDevicesOptions, DeviceSearchTarget,
|
|
1
|
+
import { ChainCapability, DeviceInfo, IHardwareWallet, IConnector, TransportType, SearchDevicesOptions, DeviceSearchTarget, Response, ChainForFingerprint, UiResponseEvent, HardwareEventMap, DeviceEventListener, AllNetworkGetAddressParams, AllNetworkAddressResponse, NullableCallArg, IHardwareCallParams, EvmGetAddressParams, EvmAddress, EvmSignTxParams, EvmSignedTx, EvmSignMsgParams, EvmSignature, EvmSignTypedDataParams, BtcGetAddressParams, BtcAddress, BtcGetPublicKeyParams, BtcPublicKey, BtcSignTxParams, BtcSignedTx, BtcSignPsbtParams, BtcSignedPsbt, BtcSignMsgParams, BtcSignature, IHardwareCommonCallParams, SolGetAddressParams, SolAddress, SolSignTxParams, SolSignedTx, SolSignMsgParams, SolSignature, TronGetAddressParams, TronAddress, TronSignTxParams, TronSignedTx, TronSignMsgParams, TronSignature } from '@onekeyfe/hwk-adapter-core';
|
|
2
2
|
|
|
3
3
|
/** Keystone `DataType`: 1 = transaction, 2 = personal message. */
|
|
4
4
|
declare enum TronSignType {
|
|
@@ -59,7 +59,7 @@ interface KeystoneBtcSignRequestAccount {
|
|
|
59
59
|
xfp: string;
|
|
60
60
|
address?: string;
|
|
61
61
|
}
|
|
62
|
-
/** Script types for purposes 44'/49'/84'/86'
|
|
62
|
+
/** Script types for purposes 44'/49'/84'/86'. */
|
|
63
63
|
type BtcScriptType = 'p2pkh' | 'p2sh-p2wpkh' | 'p2wpkh' | 'p2tr';
|
|
64
64
|
interface KeystoneSolSignRequestInput {
|
|
65
65
|
requestId: string;
|
|
@@ -134,15 +134,16 @@ declare class KeystoneUrEngine {
|
|
|
134
134
|
parseEthSignature(ur: KeystoneUr): KeystoneEthSignatureResult;
|
|
135
135
|
/** Derives an EVM address offline; `relativeDerivePath` is relative to the xpub, e.g. `'0/0'`. */
|
|
136
136
|
deriveEvmAddressFromXpub(xpub: string, relativeDerivePath: string): string;
|
|
137
|
-
/**
|
|
138
|
-
* `CryptoHDKey` always emits mainnet xpub version bytes (`0488B21E`), so `hdkey` parses it as is.
|
|
139
|
-
* `p2tr` needs an ECC lib for BIP-341 tweaking, not wired here.
|
|
140
|
-
*/
|
|
137
|
+
/** `CryptoHDKey` always emits mainnet xpub version bytes (`0488B21E`), so `hdkey` parses it as is. */
|
|
141
138
|
deriveBtcAddressFromXpub(xpub: string, relativeDerivePath: string, scriptType: BtcScriptType): string;
|
|
142
139
|
deriveBtcAddressFromPublicKey(publicKeyHex: string, scriptType: BtcScriptType): string;
|
|
143
140
|
buildBtcPsbtRequest(unsignedPsbtHex: string): KeystoneUr;
|
|
144
|
-
/**
|
|
145
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Returns the hex-encoded (possibly still-unsigned-in-part) PSBT the device replied with. A PSBT
|
|
143
|
+
* carries no request id, so the reply is bound to the request by its unsigned transaction, which
|
|
144
|
+
* signing never changes (BIP-174); a scan of another PSBT's signature is refused.
|
|
145
|
+
*/
|
|
146
|
+
parseBtcPsbt(ur: KeystoneUr, requestPsbtHex: string): string;
|
|
146
147
|
buildBtcMessageSignRequest(params: {
|
|
147
148
|
requestId: string;
|
|
148
149
|
/** Hex, no 0x prefix. */
|
|
@@ -206,7 +207,6 @@ declare function toDeviceInfo(record: KeystoneDeviceRecord): DeviceInfo;
|
|
|
206
207
|
/** Device row for a not-yet-synced wallet during a cold-start round trip. */
|
|
207
208
|
declare function placeholderDeviceInfo(): DeviceInfo;
|
|
208
209
|
|
|
209
|
-
/** Key material for one operation, keyed by `accountKey()`; never retained. */
|
|
210
210
|
/**
|
|
211
211
|
* How an all-network item reads its key. QR: from the bundle's one scan, never the device again.
|
|
212
212
|
* USB: straight from the device, on the session the bundle started with.
|
|
@@ -277,7 +277,6 @@ declare class KeystoneAdapter implements IHardwareWallet {
|
|
|
277
277
|
/** Best-effort disconnect; the session is retired either way so it cannot be selected again. */
|
|
278
278
|
private _retireUsbSession;
|
|
279
279
|
searchDeviceTargets(options?: SearchDevicesOptions): Promise<DeviceSearchTarget[]>;
|
|
280
|
-
listConnectionTargets(options?: SearchDevicesOptions): Promise<ConnectionTarget[]>;
|
|
281
280
|
connectDevice(searchTargetId: string): Promise<Response<string>>;
|
|
282
281
|
/**
|
|
283
282
|
* QR has nothing to tear down. A USB session is closed, and the record is demoted to QR-only or
|
|
@@ -298,20 +297,21 @@ declare class KeystoneAdapter implements IHardwareWallet {
|
|
|
298
297
|
off<K extends keyof HardwareEventMap>(event: K, listener: (event: HardwareEventMap[K]) => void): void;
|
|
299
298
|
off(event: string, listener: DeviceEventListener): void;
|
|
300
299
|
importFromQr(options?: ImportFromQrOptions): Promise<Response<DeviceInfo>>;
|
|
300
|
+
private _importFromQr;
|
|
301
301
|
allNetworkGetAddress: (connectId: string, deviceId: string, params: AllNetworkGetAddressParams) => Promise<Response<AllNetworkAddressResponse[]>>;
|
|
302
|
-
evmGetAddress(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
303
|
-
evmSignTransaction(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
304
|
-
evmSignMessage(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
305
|
-
evmSignTypedData(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
306
|
-
btcGetAddress(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
302
|
+
evmGetAddress(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<EvmGetAddressParams>>, bundle?: BundleAccess): Promise<Response<EvmAddress>>;
|
|
303
|
+
evmSignTransaction(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<EvmSignTxParams>>): Promise<Response<EvmSignedTx>>;
|
|
304
|
+
evmSignMessage(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<EvmSignMsgParams>>): Promise<Response<EvmSignature>>;
|
|
305
|
+
evmSignTypedData(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<EvmSignTypedDataParams>>): Promise<Response<EvmSignature>>;
|
|
306
|
+
btcGetAddress(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<BtcGetAddressParams>>, bundle?: BundleAccess): Promise<Response<BtcAddress>>;
|
|
307
307
|
/**
|
|
308
308
|
* `params.path` must be an account path (`m/84'/0'/0'`), the level Keystone syncs. An xpub is
|
|
309
309
|
* script-type agnostic, so `86'` works here even though `btcGetAddress` rejects it.
|
|
310
310
|
*/
|
|
311
|
-
btcGetPublicKey(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
311
|
+
btcGetPublicKey(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<BtcGetPublicKeyParams>>, bundle?: BundleAccess): Promise<Response<BtcPublicKey>>;
|
|
312
312
|
btcSignTransaction(_connectId?: NullableCallArg<string>, _deviceId?: NullableCallArg<string>, _params?: NullableCallArg<IHardwareCallParams<BtcSignTxParams>>): Promise<Response<BtcSignedTx>>;
|
|
313
|
-
btcSignPsbt(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
314
|
-
btcSignMessage(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
313
|
+
btcSignPsbt(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<BtcSignPsbtParams>>): Promise<Response<BtcSignedPsbt>>;
|
|
314
|
+
btcSignMessage(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<BtcSignMsgParams>>): Promise<Response<BtcSignature>>;
|
|
315
315
|
/**
|
|
316
316
|
* Returns the known master fingerprint for the named wallet without asking the device (a QR
|
|
317
317
|
* round trip only to repeat it would cost a scan). Use it to name the wallet, for example as a
|
|
@@ -320,14 +320,23 @@ declare class KeystoneAdapter implements IHardwareWallet {
|
|
|
320
320
|
btcGetMasterFingerprint(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCommonCallParams>): Promise<Response<{
|
|
321
321
|
masterFingerprint: string;
|
|
322
322
|
}>>;
|
|
323
|
-
solGetAddress(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
324
|
-
solSignTransaction(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
325
|
-
solSignMessage(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
326
|
-
tronGetAddress(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
327
|
-
tronSignTransaction(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
328
|
-
tronSignMessage(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
323
|
+
solGetAddress(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<SolGetAddressParams>>, bundle?: BundleAccess): Promise<Response<SolAddress>>;
|
|
324
|
+
solSignTransaction(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<SolSignTxParams>>): Promise<Response<SolSignedTx>>;
|
|
325
|
+
solSignMessage(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<SolSignMsgParams>>): Promise<Response<SolSignature>>;
|
|
326
|
+
tronGetAddress(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<TronGetAddressParams>>, bundle?: BundleAccess): Promise<Response<TronAddress>>;
|
|
327
|
+
tronSignTransaction(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<TronSignTxParams>>): Promise<Response<TronSignedTx>>;
|
|
328
|
+
tronSignMessage(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<TronSignMsgParams>>): Promise<Response<TronSignature>>;
|
|
329
|
+
/** Resolves the call's target and requires params, before any method-specific check. */
|
|
330
|
+
private _beginCall;
|
|
331
|
+
/** Derives a leaf address offline from its account xpub. */
|
|
332
|
+
private _addressFromAccountXpub;
|
|
333
|
+
private _evmSign;
|
|
334
|
+
private _solSign;
|
|
335
|
+
private _tronSign;
|
|
329
336
|
private _runJob;
|
|
330
337
|
private _fetchAccountXpub;
|
|
338
|
+
/** The exported key behind an address, reduced to the fields that identify it. */
|
|
339
|
+
private _exportedAccountKey;
|
|
331
340
|
/**
|
|
332
341
|
* Signing needs only the wallet's mfp: the device re-derives the key from path+xfp, so no
|
|
333
342
|
* per-path account lookup happens here.
|
|
@@ -339,7 +348,6 @@ declare class KeystoneAdapter implements IHardwareWallet {
|
|
|
339
348
|
* each ask the device directly, like other vendors, on the session found here.
|
|
340
349
|
*/
|
|
341
350
|
private _prepareAllNetworkBundle;
|
|
342
|
-
/** Resolve the wallet's master fingerprint from the connectId and/or deviceId the caller passed. */
|
|
343
351
|
/**
|
|
344
352
|
* A positional wallet id and an operation id must name the same wallet: otherwise the call
|
|
345
353
|
* would run on the operation's wallet while the caller files the result under the other one.
|
|
@@ -395,13 +403,15 @@ declare class KeystoneAdapter implements IHardwareWallet {
|
|
|
395
403
|
* a cancel reach the wait before the QR timeout.
|
|
396
404
|
*/
|
|
397
405
|
private _awaitQrResponse;
|
|
398
|
-
|
|
399
|
-
private
|
|
400
|
-
private
|
|
406
|
+
/** Shows `data` for the device to scan, or with no `data` asks the host to scan the device. */
|
|
407
|
+
private _requestQrAndAwaitResponse;
|
|
408
|
+
private _callUsbResolveUr;
|
|
401
409
|
private _runUsbTeardown;
|
|
402
410
|
private _waitForUsbOperationsToDrain;
|
|
403
411
|
private _retainUsbOperation;
|
|
404
412
|
private static _abortable;
|
|
413
|
+
/** Settles with `signal`'s reason once it aborts; a later outcome of `promise` is dropped. */
|
|
414
|
+
private static _untilAborted;
|
|
405
415
|
private static _throwIfAborted;
|
|
406
416
|
/** A response without the request's id is as unrelated as one with another id. */
|
|
407
417
|
private static _assertRequestIdMatches;
|
|
@@ -412,8 +422,9 @@ declare class KeystoneAdapter implements IHardwareWallet {
|
|
|
412
422
|
/** Always returns an `m/`-prefixed path, regardless of the input's casing/prefix. */
|
|
413
423
|
declare function normalizePath(path: string): string;
|
|
414
424
|
/**
|
|
415
|
-
* Splits a
|
|
416
|
-
*
|
|
425
|
+
* Splits a leaf path after its last hardened segment: the account path is what Keystone exports,
|
|
426
|
+
* the unhardened rest is derived from it offline (`change/index`, or a bare `index` for Ledger
|
|
427
|
+
* Legacy `m/44'/60'/0'/<index>`). A path of 3 or fewer segments is already an account path.
|
|
417
428
|
*/
|
|
418
429
|
declare function splitAccountPath(path: string): {
|
|
419
430
|
accountPath: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChainCapability, DeviceInfo, IHardwareWallet, IConnector, TransportType, SearchDevicesOptions, DeviceSearchTarget,
|
|
1
|
+
import { ChainCapability, DeviceInfo, IHardwareWallet, IConnector, TransportType, SearchDevicesOptions, DeviceSearchTarget, Response, ChainForFingerprint, UiResponseEvent, HardwareEventMap, DeviceEventListener, AllNetworkGetAddressParams, AllNetworkAddressResponse, NullableCallArg, IHardwareCallParams, EvmGetAddressParams, EvmAddress, EvmSignTxParams, EvmSignedTx, EvmSignMsgParams, EvmSignature, EvmSignTypedDataParams, BtcGetAddressParams, BtcAddress, BtcGetPublicKeyParams, BtcPublicKey, BtcSignTxParams, BtcSignedTx, BtcSignPsbtParams, BtcSignedPsbt, BtcSignMsgParams, BtcSignature, IHardwareCommonCallParams, SolGetAddressParams, SolAddress, SolSignTxParams, SolSignedTx, SolSignMsgParams, SolSignature, TronGetAddressParams, TronAddress, TronSignTxParams, TronSignedTx, TronSignMsgParams, TronSignature } from '@onekeyfe/hwk-adapter-core';
|
|
2
2
|
|
|
3
3
|
/** Keystone `DataType`: 1 = transaction, 2 = personal message. */
|
|
4
4
|
declare enum TronSignType {
|
|
@@ -59,7 +59,7 @@ interface KeystoneBtcSignRequestAccount {
|
|
|
59
59
|
xfp: string;
|
|
60
60
|
address?: string;
|
|
61
61
|
}
|
|
62
|
-
/** Script types for purposes 44'/49'/84'/86'
|
|
62
|
+
/** Script types for purposes 44'/49'/84'/86'. */
|
|
63
63
|
type BtcScriptType = 'p2pkh' | 'p2sh-p2wpkh' | 'p2wpkh' | 'p2tr';
|
|
64
64
|
interface KeystoneSolSignRequestInput {
|
|
65
65
|
requestId: string;
|
|
@@ -134,15 +134,16 @@ declare class KeystoneUrEngine {
|
|
|
134
134
|
parseEthSignature(ur: KeystoneUr): KeystoneEthSignatureResult;
|
|
135
135
|
/** Derives an EVM address offline; `relativeDerivePath` is relative to the xpub, e.g. `'0/0'`. */
|
|
136
136
|
deriveEvmAddressFromXpub(xpub: string, relativeDerivePath: string): string;
|
|
137
|
-
/**
|
|
138
|
-
* `CryptoHDKey` always emits mainnet xpub version bytes (`0488B21E`), so `hdkey` parses it as is.
|
|
139
|
-
* `p2tr` needs an ECC lib for BIP-341 tweaking, not wired here.
|
|
140
|
-
*/
|
|
137
|
+
/** `CryptoHDKey` always emits mainnet xpub version bytes (`0488B21E`), so `hdkey` parses it as is. */
|
|
141
138
|
deriveBtcAddressFromXpub(xpub: string, relativeDerivePath: string, scriptType: BtcScriptType): string;
|
|
142
139
|
deriveBtcAddressFromPublicKey(publicKeyHex: string, scriptType: BtcScriptType): string;
|
|
143
140
|
buildBtcPsbtRequest(unsignedPsbtHex: string): KeystoneUr;
|
|
144
|
-
/**
|
|
145
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Returns the hex-encoded (possibly still-unsigned-in-part) PSBT the device replied with. A PSBT
|
|
143
|
+
* carries no request id, so the reply is bound to the request by its unsigned transaction, which
|
|
144
|
+
* signing never changes (BIP-174); a scan of another PSBT's signature is refused.
|
|
145
|
+
*/
|
|
146
|
+
parseBtcPsbt(ur: KeystoneUr, requestPsbtHex: string): string;
|
|
146
147
|
buildBtcMessageSignRequest(params: {
|
|
147
148
|
requestId: string;
|
|
148
149
|
/** Hex, no 0x prefix. */
|
|
@@ -206,7 +207,6 @@ declare function toDeviceInfo(record: KeystoneDeviceRecord): DeviceInfo;
|
|
|
206
207
|
/** Device row for a not-yet-synced wallet during a cold-start round trip. */
|
|
207
208
|
declare function placeholderDeviceInfo(): DeviceInfo;
|
|
208
209
|
|
|
209
|
-
/** Key material for one operation, keyed by `accountKey()`; never retained. */
|
|
210
210
|
/**
|
|
211
211
|
* How an all-network item reads its key. QR: from the bundle's one scan, never the device again.
|
|
212
212
|
* USB: straight from the device, on the session the bundle started with.
|
|
@@ -277,7 +277,6 @@ declare class KeystoneAdapter implements IHardwareWallet {
|
|
|
277
277
|
/** Best-effort disconnect; the session is retired either way so it cannot be selected again. */
|
|
278
278
|
private _retireUsbSession;
|
|
279
279
|
searchDeviceTargets(options?: SearchDevicesOptions): Promise<DeviceSearchTarget[]>;
|
|
280
|
-
listConnectionTargets(options?: SearchDevicesOptions): Promise<ConnectionTarget[]>;
|
|
281
280
|
connectDevice(searchTargetId: string): Promise<Response<string>>;
|
|
282
281
|
/**
|
|
283
282
|
* QR has nothing to tear down. A USB session is closed, and the record is demoted to QR-only or
|
|
@@ -298,20 +297,21 @@ declare class KeystoneAdapter implements IHardwareWallet {
|
|
|
298
297
|
off<K extends keyof HardwareEventMap>(event: K, listener: (event: HardwareEventMap[K]) => void): void;
|
|
299
298
|
off(event: string, listener: DeviceEventListener): void;
|
|
300
299
|
importFromQr(options?: ImportFromQrOptions): Promise<Response<DeviceInfo>>;
|
|
300
|
+
private _importFromQr;
|
|
301
301
|
allNetworkGetAddress: (connectId: string, deviceId: string, params: AllNetworkGetAddressParams) => Promise<Response<AllNetworkAddressResponse[]>>;
|
|
302
|
-
evmGetAddress(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
303
|
-
evmSignTransaction(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
304
|
-
evmSignMessage(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
305
|
-
evmSignTypedData(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
306
|
-
btcGetAddress(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
302
|
+
evmGetAddress(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<EvmGetAddressParams>>, bundle?: BundleAccess): Promise<Response<EvmAddress>>;
|
|
303
|
+
evmSignTransaction(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<EvmSignTxParams>>): Promise<Response<EvmSignedTx>>;
|
|
304
|
+
evmSignMessage(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<EvmSignMsgParams>>): Promise<Response<EvmSignature>>;
|
|
305
|
+
evmSignTypedData(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<EvmSignTypedDataParams>>): Promise<Response<EvmSignature>>;
|
|
306
|
+
btcGetAddress(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<BtcGetAddressParams>>, bundle?: BundleAccess): Promise<Response<BtcAddress>>;
|
|
307
307
|
/**
|
|
308
308
|
* `params.path` must be an account path (`m/84'/0'/0'`), the level Keystone syncs. An xpub is
|
|
309
309
|
* script-type agnostic, so `86'` works here even though `btcGetAddress` rejects it.
|
|
310
310
|
*/
|
|
311
|
-
btcGetPublicKey(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
311
|
+
btcGetPublicKey(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<BtcGetPublicKeyParams>>, bundle?: BundleAccess): Promise<Response<BtcPublicKey>>;
|
|
312
312
|
btcSignTransaction(_connectId?: NullableCallArg<string>, _deviceId?: NullableCallArg<string>, _params?: NullableCallArg<IHardwareCallParams<BtcSignTxParams>>): Promise<Response<BtcSignedTx>>;
|
|
313
|
-
btcSignPsbt(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
314
|
-
btcSignMessage(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
313
|
+
btcSignPsbt(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<BtcSignPsbtParams>>): Promise<Response<BtcSignedPsbt>>;
|
|
314
|
+
btcSignMessage(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<BtcSignMsgParams>>): Promise<Response<BtcSignature>>;
|
|
315
315
|
/**
|
|
316
316
|
* Returns the known master fingerprint for the named wallet without asking the device (a QR
|
|
317
317
|
* round trip only to repeat it would cost a scan). Use it to name the wallet, for example as a
|
|
@@ -320,14 +320,23 @@ declare class KeystoneAdapter implements IHardwareWallet {
|
|
|
320
320
|
btcGetMasterFingerprint(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCommonCallParams>): Promise<Response<{
|
|
321
321
|
masterFingerprint: string;
|
|
322
322
|
}>>;
|
|
323
|
-
solGetAddress(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
324
|
-
solSignTransaction(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
325
|
-
solSignMessage(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
326
|
-
tronGetAddress(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
327
|
-
tronSignTransaction(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
328
|
-
tronSignMessage(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>,
|
|
323
|
+
solGetAddress(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<SolGetAddressParams>>, bundle?: BundleAccess): Promise<Response<SolAddress>>;
|
|
324
|
+
solSignTransaction(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<SolSignTxParams>>): Promise<Response<SolSignedTx>>;
|
|
325
|
+
solSignMessage(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<SolSignMsgParams>>): Promise<Response<SolSignature>>;
|
|
326
|
+
tronGetAddress(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<TronGetAddressParams>>, bundle?: BundleAccess): Promise<Response<TronAddress>>;
|
|
327
|
+
tronSignTransaction(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<TronSignTxParams>>): Promise<Response<TronSignedTx>>;
|
|
328
|
+
tronSignMessage(connectIdArg?: NullableCallArg<string>, deviceIdArg?: NullableCallArg<string>, paramsArg?: NullableCallArg<IHardwareCallParams<TronSignMsgParams>>): Promise<Response<TronSignature>>;
|
|
329
|
+
/** Resolves the call's target and requires params, before any method-specific check. */
|
|
330
|
+
private _beginCall;
|
|
331
|
+
/** Derives a leaf address offline from its account xpub. */
|
|
332
|
+
private _addressFromAccountXpub;
|
|
333
|
+
private _evmSign;
|
|
334
|
+
private _solSign;
|
|
335
|
+
private _tronSign;
|
|
329
336
|
private _runJob;
|
|
330
337
|
private _fetchAccountXpub;
|
|
338
|
+
/** The exported key behind an address, reduced to the fields that identify it. */
|
|
339
|
+
private _exportedAccountKey;
|
|
331
340
|
/**
|
|
332
341
|
* Signing needs only the wallet's mfp: the device re-derives the key from path+xfp, so no
|
|
333
342
|
* per-path account lookup happens here.
|
|
@@ -339,7 +348,6 @@ declare class KeystoneAdapter implements IHardwareWallet {
|
|
|
339
348
|
* each ask the device directly, like other vendors, on the session found here.
|
|
340
349
|
*/
|
|
341
350
|
private _prepareAllNetworkBundle;
|
|
342
|
-
/** Resolve the wallet's master fingerprint from the connectId and/or deviceId the caller passed. */
|
|
343
351
|
/**
|
|
344
352
|
* A positional wallet id and an operation id must name the same wallet: otherwise the call
|
|
345
353
|
* would run on the operation's wallet while the caller files the result under the other one.
|
|
@@ -395,13 +403,15 @@ declare class KeystoneAdapter implements IHardwareWallet {
|
|
|
395
403
|
* a cancel reach the wait before the QR timeout.
|
|
396
404
|
*/
|
|
397
405
|
private _awaitQrResponse;
|
|
398
|
-
|
|
399
|
-
private
|
|
400
|
-
private
|
|
406
|
+
/** Shows `data` for the device to scan, or with no `data` asks the host to scan the device. */
|
|
407
|
+
private _requestQrAndAwaitResponse;
|
|
408
|
+
private _callUsbResolveUr;
|
|
401
409
|
private _runUsbTeardown;
|
|
402
410
|
private _waitForUsbOperationsToDrain;
|
|
403
411
|
private _retainUsbOperation;
|
|
404
412
|
private static _abortable;
|
|
413
|
+
/** Settles with `signal`'s reason once it aborts; a later outcome of `promise` is dropped. */
|
|
414
|
+
private static _untilAborted;
|
|
405
415
|
private static _throwIfAborted;
|
|
406
416
|
/** A response without the request's id is as unrelated as one with another id. */
|
|
407
417
|
private static _assertRequestIdMatches;
|
|
@@ -412,8 +422,9 @@ declare class KeystoneAdapter implements IHardwareWallet {
|
|
|
412
422
|
/** Always returns an `m/`-prefixed path, regardless of the input's casing/prefix. */
|
|
413
423
|
declare function normalizePath(path: string): string;
|
|
414
424
|
/**
|
|
415
|
-
* Splits a
|
|
416
|
-
*
|
|
425
|
+
* Splits a leaf path after its last hardened segment: the account path is what Keystone exports,
|
|
426
|
+
* the unhardened rest is derived from it offline (`change/index`, or a bare `index` for Ledger
|
|
427
|
+
* Legacy `m/44'/60'/0'/<index>`). A path of 3 or fewer segments is already an account path.
|
|
417
428
|
*/
|
|
418
429
|
declare function splitAccountPath(path: string): {
|
|
419
430
|
accountPath: string;
|