@onekeyfe/hwk-keystone-adapter 1.2.5-alpha.0 → 1.2.5-alpha.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/dist/index.d.mts CHANGED
@@ -174,17 +174,15 @@ declare class KeystoneUrEngine {
174
174
  }
175
175
 
176
176
  declare const KEYSTONE_WALLET_CONNECT_ID_PREFIX = "keystone-wallet:";
177
- /** Fixed public source used to derive a collision-resistant wallet id. */
178
- declare const KEYSTONE_WALLET_ID_PATH = "m/44'/60'/0'";
179
- declare function walletConnectId(walletId: string): string;
177
+ /** Account a QR cold start requests when the caller named no path; any path returns the mfp. */
178
+ declare const KEYSTONE_COLD_START_PATH = "m/44'/60'/0'";
179
+ declare function walletConnectId(masterFingerprint: string): string;
180
180
  interface KeystoneAccountEntry extends KeystoneParsedAccount {
181
181
  hwkChain: ChainCapability;
182
182
  }
183
183
  declare function accountKey(hwkChain: ChainCapability, path: string): string;
184
184
  interface KeystoneDeviceRecord {
185
- /** SHA-256 id derived from the fixed account-level identity xpub. */
186
- walletId: string;
187
- /** Lowercase 8-char BIP32 fingerprint used by BC-UR as xfp, never as identity. */
185
+ /** Lowercase 8-char BIP32 master fingerprint: the wallet identity and the BC-UR xfp. */
188
186
  masterFingerprint: string;
189
187
  connectId: string;
190
188
  /** Optional physical-device id exposed by some Keystone QR export menus. */
@@ -203,8 +201,7 @@ interface KeystoneDeviceRecord {
203
201
  /** True after one QR round trip; on USB disconnect it decides demote-to-QR versus drop. */
204
202
  qrSynced?: boolean;
205
203
  }
206
- declare function deriveKeystoneWalletId(accounts: KeystoneParsedAccount[]): string;
207
- declare function createDeviceRecord(walletId: string, masterFingerprint: string): KeystoneDeviceRecord;
204
+ declare function createDeviceRecord(masterFingerprint: string): KeystoneDeviceRecord;
208
205
  declare function toDeviceInfo(record: KeystoneDeviceRecord): DeviceInfo;
209
206
  /** Device row for a not-yet-synced wallet during a cold-start round trip. */
210
207
  declare function placeholderDeviceInfo(): DeviceInfo;
@@ -213,13 +210,13 @@ declare function placeholderDeviceInfo(): DeviceInfo;
213
210
  type AccountBook = Map<string, KeystoneAccountEntry>;
214
211
  interface ImportFromQrOptions {
215
212
  /**
216
- * 'request' asks the device for the identity xpub; 'scan' waits for whatever export it already
217
- * shows. Only the wallet identity is learned either way.
213
+ * 'request' asks the device for one account; 'scan' waits for whatever export it already shows.
214
+ * Only the wallet's master fingerprint is learned either way.
218
215
  */
219
216
  mode?: 'request' | 'scan';
220
217
  }
221
218
  /**
222
- * QR and USB behind one `IHardwareWallet`, keyed by a wallet id derived from the identity xpub.
219
+ * QR and USB behind one `IHardwareWallet`, keyed by the wallet's BIP32 master fingerprint.
223
220
  * Key material is fetched per operation and never retained.
224
221
  */
225
222
  declare class KeystoneAdapter implements IHardwareWallet {
@@ -323,10 +320,7 @@ declare class KeystoneAdapter implements IHardwareWallet {
323
320
  * request because the device limits that channel.
324
321
  */
325
322
  private _prefetchAllNetworkAccounts;
326
- /**
327
- * Resolve only the stable 64-hex wallet identity. The 8-hex BIP32 master
328
- * fingerprint is protocol metadata and is never accepted as a lookup key.
329
- */
323
+ /** Resolve the wallet's master fingerprint from the connectId and/or deviceId the caller passed. */
330
324
  private _resolveTarget;
331
325
  private _assertParsedIdentity;
332
326
  /**
@@ -335,8 +329,8 @@ declare class KeystoneAdapter implements IHardwareWallet {
335
329
  */
336
330
  private _upsertDeviceRecord;
337
331
  /**
338
- * Opens a permitted USB Keystone, reads its mfp, and derives the wallet id from the identity
339
- * xpub. A known wallet gains USB in place (`device-changed`); an unseen one becomes USB-only.
332
+ * Opens a permitted USB Keystone and takes its mfp as the wallet identity. A known wallet gains
333
+ * USB in place (`device-changed`); an unseen one becomes USB-only.
340
334
  */
341
335
  private _connectUsb;
342
336
  private _connectUsbExclusive;
@@ -368,7 +362,7 @@ declare class KeystoneAdapter implements IHardwareWallet {
368
362
  * through the operation route; a cold start returns undefined.
369
363
  */
370
364
  private _activeOperationId;
371
- /** Routes are keyed by connectId; a job key may be the bare wallet id. */
365
+ /** Routes are keyed by connectId; a job key may be the bare master fingerprint. */
372
366
  private _operationRouteForIdentifier;
373
367
  /**
374
368
  * A QR prompt has no transport to interrupt; releasing the registry slot on abort is what lets
@@ -401,4 +395,4 @@ declare function splitAccountPath(path: string): {
401
395
  /** BIP-44/49/84/86 purpose to script type; undefined for any other purpose. */
402
396
  declare function btcScriptTypeFromPath(path: string): BtcScriptType | undefined;
403
397
 
404
- export { type BtcScriptType, type ImportFromQrOptions, KEYSTONE_WALLET_CONNECT_ID_PREFIX, KEYSTONE_WALLET_ID_PATH, type KeystoneAccountEntry, KeystoneAdapter, type KeystoneBtcSignRequestAccount, type KeystoneBtcSignatureResult, type KeystoneDerivationCurve, type KeystoneDeviceRecord, type KeystoneEthSignRequestInput, type KeystoneEthSignatureResult, type KeystoneKeyDerivationRequestInput, type KeystoneKeySchema, type KeystoneParsedAccount, type KeystoneParsedMultiAccounts, type KeystoneSolSignRequestInput, type KeystoneSolSignatureResult, type KeystoneTronSignRequestInput, type KeystoneTronSignatureResult, type KeystoneUr, KeystoneUrEngine, accountKey, btcScriptTypeFromPath, createDeviceRecord, deriveKeystoneWalletId, normalizePath, placeholderDeviceInfo, splitAccountPath, toDeviceInfo, walletConnectId };
398
+ export { type BtcScriptType, type ImportFromQrOptions, KEYSTONE_COLD_START_PATH, KEYSTONE_WALLET_CONNECT_ID_PREFIX, type KeystoneAccountEntry, KeystoneAdapter, type KeystoneBtcSignRequestAccount, type KeystoneBtcSignatureResult, type KeystoneDerivationCurve, type KeystoneDeviceRecord, type KeystoneEthSignRequestInput, type KeystoneEthSignatureResult, type KeystoneKeyDerivationRequestInput, type KeystoneKeySchema, type KeystoneParsedAccount, type KeystoneParsedMultiAccounts, type KeystoneSolSignRequestInput, type KeystoneSolSignatureResult, type KeystoneTronSignRequestInput, type KeystoneTronSignatureResult, type KeystoneUr, KeystoneUrEngine, accountKey, btcScriptTypeFromPath, createDeviceRecord, normalizePath, placeholderDeviceInfo, splitAccountPath, toDeviceInfo, walletConnectId };
package/dist/index.d.ts CHANGED
@@ -174,17 +174,15 @@ declare class KeystoneUrEngine {
174
174
  }
175
175
 
176
176
  declare const KEYSTONE_WALLET_CONNECT_ID_PREFIX = "keystone-wallet:";
177
- /** Fixed public source used to derive a collision-resistant wallet id. */
178
- declare const KEYSTONE_WALLET_ID_PATH = "m/44'/60'/0'";
179
- declare function walletConnectId(walletId: string): string;
177
+ /** Account a QR cold start requests when the caller named no path; any path returns the mfp. */
178
+ declare const KEYSTONE_COLD_START_PATH = "m/44'/60'/0'";
179
+ declare function walletConnectId(masterFingerprint: string): string;
180
180
  interface KeystoneAccountEntry extends KeystoneParsedAccount {
181
181
  hwkChain: ChainCapability;
182
182
  }
183
183
  declare function accountKey(hwkChain: ChainCapability, path: string): string;
184
184
  interface KeystoneDeviceRecord {
185
- /** SHA-256 id derived from the fixed account-level identity xpub. */
186
- walletId: string;
187
- /** Lowercase 8-char BIP32 fingerprint used by BC-UR as xfp, never as identity. */
185
+ /** Lowercase 8-char BIP32 master fingerprint: the wallet identity and the BC-UR xfp. */
188
186
  masterFingerprint: string;
189
187
  connectId: string;
190
188
  /** Optional physical-device id exposed by some Keystone QR export menus. */
@@ -203,8 +201,7 @@ interface KeystoneDeviceRecord {
203
201
  /** True after one QR round trip; on USB disconnect it decides demote-to-QR versus drop. */
204
202
  qrSynced?: boolean;
205
203
  }
206
- declare function deriveKeystoneWalletId(accounts: KeystoneParsedAccount[]): string;
207
- declare function createDeviceRecord(walletId: string, masterFingerprint: string): KeystoneDeviceRecord;
204
+ declare function createDeviceRecord(masterFingerprint: string): KeystoneDeviceRecord;
208
205
  declare function toDeviceInfo(record: KeystoneDeviceRecord): DeviceInfo;
209
206
  /** Device row for a not-yet-synced wallet during a cold-start round trip. */
210
207
  declare function placeholderDeviceInfo(): DeviceInfo;
@@ -213,13 +210,13 @@ declare function placeholderDeviceInfo(): DeviceInfo;
213
210
  type AccountBook = Map<string, KeystoneAccountEntry>;
214
211
  interface ImportFromQrOptions {
215
212
  /**
216
- * 'request' asks the device for the identity xpub; 'scan' waits for whatever export it already
217
- * shows. Only the wallet identity is learned either way.
213
+ * 'request' asks the device for one account; 'scan' waits for whatever export it already shows.
214
+ * Only the wallet's master fingerprint is learned either way.
218
215
  */
219
216
  mode?: 'request' | 'scan';
220
217
  }
221
218
  /**
222
- * QR and USB behind one `IHardwareWallet`, keyed by a wallet id derived from the identity xpub.
219
+ * QR and USB behind one `IHardwareWallet`, keyed by the wallet's BIP32 master fingerprint.
223
220
  * Key material is fetched per operation and never retained.
224
221
  */
225
222
  declare class KeystoneAdapter implements IHardwareWallet {
@@ -323,10 +320,7 @@ declare class KeystoneAdapter implements IHardwareWallet {
323
320
  * request because the device limits that channel.
324
321
  */
325
322
  private _prefetchAllNetworkAccounts;
326
- /**
327
- * Resolve only the stable 64-hex wallet identity. The 8-hex BIP32 master
328
- * fingerprint is protocol metadata and is never accepted as a lookup key.
329
- */
323
+ /** Resolve the wallet's master fingerprint from the connectId and/or deviceId the caller passed. */
330
324
  private _resolveTarget;
331
325
  private _assertParsedIdentity;
332
326
  /**
@@ -335,8 +329,8 @@ declare class KeystoneAdapter implements IHardwareWallet {
335
329
  */
336
330
  private _upsertDeviceRecord;
337
331
  /**
338
- * Opens a permitted USB Keystone, reads its mfp, and derives the wallet id from the identity
339
- * xpub. A known wallet gains USB in place (`device-changed`); an unseen one becomes USB-only.
332
+ * Opens a permitted USB Keystone and takes its mfp as the wallet identity. A known wallet gains
333
+ * USB in place (`device-changed`); an unseen one becomes USB-only.
340
334
  */
341
335
  private _connectUsb;
342
336
  private _connectUsbExclusive;
@@ -368,7 +362,7 @@ declare class KeystoneAdapter implements IHardwareWallet {
368
362
  * through the operation route; a cold start returns undefined.
369
363
  */
370
364
  private _activeOperationId;
371
- /** Routes are keyed by connectId; a job key may be the bare wallet id. */
365
+ /** Routes are keyed by connectId; a job key may be the bare master fingerprint. */
372
366
  private _operationRouteForIdentifier;
373
367
  /**
374
368
  * A QR prompt has no transport to interrupt; releasing the registry slot on abort is what lets
@@ -401,4 +395,4 @@ declare function splitAccountPath(path: string): {
401
395
  /** BIP-44/49/84/86 purpose to script type; undefined for any other purpose. */
402
396
  declare function btcScriptTypeFromPath(path: string): BtcScriptType | undefined;
403
397
 
404
- export { type BtcScriptType, type ImportFromQrOptions, KEYSTONE_WALLET_CONNECT_ID_PREFIX, KEYSTONE_WALLET_ID_PATH, type KeystoneAccountEntry, KeystoneAdapter, type KeystoneBtcSignRequestAccount, type KeystoneBtcSignatureResult, type KeystoneDerivationCurve, type KeystoneDeviceRecord, type KeystoneEthSignRequestInput, type KeystoneEthSignatureResult, type KeystoneKeyDerivationRequestInput, type KeystoneKeySchema, type KeystoneParsedAccount, type KeystoneParsedMultiAccounts, type KeystoneSolSignRequestInput, type KeystoneSolSignatureResult, type KeystoneTronSignRequestInput, type KeystoneTronSignatureResult, type KeystoneUr, KeystoneUrEngine, accountKey, btcScriptTypeFromPath, createDeviceRecord, deriveKeystoneWalletId, normalizePath, placeholderDeviceInfo, splitAccountPath, toDeviceInfo, walletConnectId };
398
+ export { type BtcScriptType, type ImportFromQrOptions, KEYSTONE_COLD_START_PATH, KEYSTONE_WALLET_CONNECT_ID_PREFIX, type KeystoneAccountEntry, KeystoneAdapter, type KeystoneBtcSignRequestAccount, type KeystoneBtcSignatureResult, type KeystoneDerivationCurve, type KeystoneDeviceRecord, type KeystoneEthSignRequestInput, type KeystoneEthSignatureResult, type KeystoneKeyDerivationRequestInput, type KeystoneKeySchema, type KeystoneParsedAccount, type KeystoneParsedMultiAccounts, type KeystoneSolSignRequestInput, type KeystoneSolSignatureResult, type KeystoneTronSignRequestInput, type KeystoneTronSignatureResult, type KeystoneUr, KeystoneUrEngine, accountKey, btcScriptTypeFromPath, createDeviceRecord, normalizePath, placeholderDeviceInfo, splitAccountPath, toDeviceInfo, walletConnectId };