hd-wallet-wasm 0.1.7 → 0.1.9

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hd-wallet-wasm",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Comprehensive HD Wallet implementation in WebAssembly - BIP-32/39/44, multi-curve, multi-chain support",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
package/src/index.mjs CHANGED
@@ -1108,6 +1108,25 @@ function createModule(wasm) {
1108
1108
  * Ed25519 EdDSA operations
1109
1109
  */
1110
1110
  ed25519: {
1111
+ /**
1112
+ * Derive Ed25519 public key from 32-byte seed
1113
+ * @param {Uint8Array} seed - 32-byte seed (will be expanded internally)
1114
+ * @returns {Uint8Array} 32-byte public key
1115
+ */
1116
+ publicKeyFromSeed(seed) {
1117
+ const seedPtr = allocAndCopy(wasm, seed);
1118
+ const pubPtr = wasm._hd_alloc(32);
1119
+ try {
1120
+ const result = wasm._hd_ed25519_pubkey_from_seed(seedPtr, pubPtr, 32);
1121
+ if (result < 0) throw new HDWalletError(result);
1122
+ return readBytes(wasm, pubPtr, 32);
1123
+ } finally {
1124
+ wasm._hd_secure_wipe(seedPtr, 32);
1125
+ wasm._hd_dealloc(seedPtr);
1126
+ wasm._hd_dealloc(pubPtr);
1127
+ }
1128
+ },
1129
+
1111
1130
  /**
1112
1131
  * Sign message with Ed25519
1113
1132
  * @param {Uint8Array} message - Message to sign
@@ -1260,6 +1279,31 @@ function createModule(wasm) {
1260
1279
  * X25519 key exchange
1261
1280
  */
1262
1281
  x25519: {
1282
+ /**
1283
+ * Derive X25519 public key from private key
1284
+ * @param {Uint8Array} privateKey - 32-byte private key
1285
+ * @returns {Uint8Array} 32-byte public key
1286
+ */
1287
+ publicKey(privateKey) {
1288
+ const privPtr = allocAndCopy(wasm, privateKey);
1289
+ const pubPtr = wasm._hd_alloc(32);
1290
+ try {
1291
+ const result = wasm._hd_x25519_pubkey(privPtr, pubPtr, 32);
1292
+ if (result < 0) throw new HDWalletError(result);
1293
+ return readBytes(wasm, pubPtr, 32);
1294
+ } finally {
1295
+ wasm._hd_secure_wipe(privPtr, 32);
1296
+ wasm._hd_dealloc(privPtr);
1297
+ wasm._hd_dealloc(pubPtr);
1298
+ }
1299
+ },
1300
+
1301
+ /**
1302
+ * Perform X25519 ECDH key exchange
1303
+ * @param {Uint8Array} privateKey - Our 32-byte private key
1304
+ * @param {Uint8Array} publicKey - Their 32-byte public key
1305
+ * @returns {Uint8Array} 32-byte shared secret
1306
+ */
1263
1307
  ecdh(privateKey, publicKey) {
1264
1308
  const privPtr = allocAndCopy(wasm, privateKey);
1265
1309
  const pubPtr = allocAndCopy(wasm, publicKey);