hd-wallet-wasm 1.1.5 → 1.2.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/README.md CHANGED
@@ -112,6 +112,50 @@ const xpub = master.toXpub();
112
112
  const pubOnly = master.neutered();
113
113
  ```
114
114
 
115
+ ### Signing & Encryption Keys (BIP-44)
116
+
117
+ The library provides dedicated helpers for deriving separate signing and encryption
118
+ keypairs from a single HD root. Signing keys use BIP-44 change=0 (external chain);
119
+ encryption keys use change=1 (internal chain).
120
+
121
+ ```javascript
122
+ import { getSigningKey, getEncryptionKey, buildSigningPath, buildEncryptionPath, WellKnownCoinType } from 'hd-wallet-wasm';
123
+
124
+ const master = wallet.hdkey.fromSeed(seed);
125
+
126
+ // Get signing keypair for Ethereum (m/44'/60'/0'/0/0)
127
+ const signing = getSigningKey(master, 60);
128
+ console.log('Signing pubkey:', wallet.utils.encodeHex(signing.publicKey));
129
+ console.log('Path:', signing.path); // "m/44'/60'/0'/0/0"
130
+
131
+ // Get encryption keypair for OrbPro marketplace (m/44'/9999'/0'/1/0)
132
+ const encryption = getEncryptionKey(master, WellKnownCoinType.ORBPRO_MARKETPLACE);
133
+ console.log('Encryption pubkey:', wallet.utils.encodeHex(encryption.publicKey));
134
+
135
+ // Use encryption key for ECDH key agreement
136
+ const shared = wallet.curves.secp256k1.ecdh(encryption.privateKey, otherPublicKey);
137
+
138
+ // Multiple keys per account (e.g., one per plugin)
139
+ const plugin0Key = getEncryptionKey(master, 9999, '0', '0');
140
+ const plugin1Key = getEncryptionKey(master, 9999, '0', '1');
141
+
142
+ // Path helpers are also available directly
143
+ const sigPath = buildSigningPath(60); // "m/44'/60'/0'/0/0"
144
+ const encPath = buildEncryptionPath(9999); // "m/44'/9999'/0'/1/0"
145
+
146
+ // Clean up
147
+ wallet.utils.secureWipe(signing.privateKey);
148
+ wallet.utils.secureWipe(encryption.privateKey);
149
+ master.wipe();
150
+ ```
151
+
152
+ Also available as instance methods on the wallet module:
153
+
154
+ ```javascript
155
+ const signing = wallet.getSigningKey(master, 60);
156
+ const encryption = wallet.getEncryptionKey(master, 9999);
157
+ ```
158
+
115
159
  ### Multi-Curve Cryptography
116
160
 
117
161
  ```javascript