hd-wallet-ui 1.1.5 → 1.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hd-wallet-ui",
3
- "version": "1.1.5",
3
+ "version": "1.2.0",
4
4
  "description": "HD Wallet modal UI — login, keys, identity, trust map, and security bond. Attach to any button in your app.",
5
5
  "type": "module",
6
6
  "main": "src/app.js",
@@ -34,7 +34,7 @@
34
34
  "bip39": "^3.1.0",
35
35
  "buffer": "^6.0.3",
36
36
  "flatbuffers": "^25.9.23",
37
- "hd-wallet-wasm": "^1.1.5",
37
+ "hd-wallet-wasm": "^1.2.0",
38
38
  "qrcode": "^1.5.3",
39
39
  "vcard-cryptoperson": "^1.1.10"
40
40
  },
package/src/app.js CHANGED
@@ -9,7 +9,7 @@
9
9
  // External Imports
10
10
  // =============================================================================
11
11
 
12
- import initHDWallet, { Curve } from 'hd-wallet-wasm';
12
+ import initHDWallet, { Curve, getSigningKey, getEncryptionKey, buildSigningPath, buildEncryptionPath, WellKnownCoinType } from 'hd-wallet-wasm';
13
13
  import { x25519, ed25519 } from '@noble/curves/ed25519';
14
14
  import { secp256k1 } from '@noble/curves/secp256k1';
15
15
  import { p256 } from '@noble/curves/p256';
@@ -36,8 +36,6 @@ import WalletStorage, { StorageMethod } from './wallet-storage.js';
36
36
  import {
37
37
  cryptoConfig,
38
38
  coinTypeToConfig,
39
- buildSigningPath,
40
- buildEncryptionPath,
41
39
  PKI_STORAGE_KEY,
42
40
  } from './constants.js';
43
41
 
@@ -366,19 +364,16 @@ async function deriveKeysFromSeed(seedPhrase) {
366
364
  * This ensures addresses match what the HD derivation grid produces.
367
365
  */
368
366
  function deriveKeysFromHDRoot(hdRoot) {
369
- // BTC signing path m/44'/0'/0'/0/0 — secp256k1
370
- const btcKey = hdRoot.derivePath(buildSigningPath(0, 0, 0));
371
- const secp256k1PrivKey = btcKey.privateKey();
372
- const secp256k1PubKey = btcKey.publicKey();
367
+ // BTC signing key m/44'/0'/0'/0/0 — secp256k1
368
+ const btcSigning = getSigningKey(hdRoot, 0, 0, 0);
373
369
 
374
- // SOL signing path m/44'/501'/0'/0/0 — ed25519
375
- const solKey = hdRoot.derivePath(buildSigningPath(501, 0, 0));
376
- const ed25519PrivKey = solKey.privateKey();
377
- const ed25519PubKey = ed25519.getPublicKey(ed25519PrivKey);
370
+ // SOL signing key m/44'/501'/0'/0/0 — ed25519
371
+ const solSigning = getSigningKey(hdRoot, 501, 0, 0);
372
+ const ed25519PubKey = ed25519.getPublicKey(solSigning.privateKey);
378
373
 
379
374
  return {
380
- secp256k1: { privateKey: secp256k1PrivKey, publicKey: secp256k1PubKey },
381
- ed25519: { privateKey: ed25519PrivKey, publicKey: ed25519PubKey },
375
+ secp256k1: { privateKey: btcSigning.privateKey, publicKey: btcSigning.publicKey },
376
+ ed25519: { privateKey: solSigning.privateKey, publicKey: ed25519PubKey },
382
377
  };
383
378
  }
384
379
 
package/src/constants.js CHANGED
@@ -51,31 +51,10 @@ export const coinTypeToConfig = Object.fromEntries(
51
51
  );
52
52
 
53
53
  // =============================================================================
54
- // Derivation Path Helpers
54
+ // Derivation Path Helpers (re-exported from hd-wallet-wasm)
55
55
  // =============================================================================
56
56
 
57
- /**
58
- * Build a BIP44 signing path: m/44'/coinType'/account'/0/index
59
- * @param {string|number} coinType - Coin type number
60
- * @param {string|number} account - Account index
61
- * @param {string|number} index - Address index
62
- * @returns {string} BIP44 derivation path
63
- */
64
- export function buildSigningPath(coinType, account = '0', index = '0') {
65
- return `m/44'/${coinType}'/${account}'/0/${index}`;
66
- }
67
-
68
- /**
69
- * Build an encryption key path: m/44'/coinType'/account'/1/index
70
- * Uses change=1 to separate encryption keys from signing keys
71
- * @param {string|number} coinType - Coin type number
72
- * @param {string|number} account - Account index
73
- * @param {string|number} index - Address index
74
- * @returns {string} Derivation path for encryption keys
75
- */
76
- export function buildEncryptionPath(coinType, account = '0', index = '0') {
77
- return `m/44'/${coinType}'/${account}'/1/${index}`;
78
- }
57
+ export { buildSigningPath, buildEncryptionPath, getSigningKey, getEncryptionKey, WellKnownCoinType } from 'hd-wallet-wasm';
79
58
 
80
59
  // =============================================================================
81
60
  // PKI Storage Key
package/src/lib.js CHANGED
@@ -11,6 +11,9 @@ export {
11
11
  coinTypeToConfig,
12
12
  buildSigningPath,
13
13
  buildEncryptionPath,
14
+ getSigningKey,
15
+ getEncryptionKey,
16
+ WellKnownCoinType,
14
17
  PKI_STORAGE_KEY,
15
18
  STORED_WALLET_KEY,
16
19
  PASSKEY_CREDENTIAL_KEY,