hd-wallet-wasm 0.1.9 → 0.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
@@ -7,9 +7,10 @@ A comprehensive HD (Hierarchical Deterministic) wallet implementation compiled t
7
7
  - **BIP-32/39/44/49/84** - Complete HD wallet derivation standards
8
8
  - **Multi-curve support** - secp256k1, Ed25519, P-256, P-384, X25519
9
9
  - **Multi-chain** - Bitcoin, Ethereum, Solana, Cosmos, Polkadot
10
+ - **AES-256-GCM** - Authenticated encryption via WASM (Crypto++/OpenSSL)
10
11
  - **Hardware wallet ready** - Trezor, Ledger, KeepKey abstraction layer
11
12
  - **Secure** - Crypto++ backend, secure memory handling
12
- - **Fast** - WebAssembly performance
13
+ - **Fast** - WebAssembly performance, synchronous cryptographic operations
13
14
  - **TypeScript** - Full type definitions included
14
15
 
15
16
  ## Installation
@@ -224,6 +225,40 @@ const pbkdf2 = wallet.utils.pbkdf2(password, salt, 100000, 32);
224
225
  wallet.utils.secureWipe(sensitiveData);
225
226
  ```
226
227
 
228
+ ### AES-GCM Encryption
229
+
230
+ ```javascript
231
+ // Generate key and IV
232
+ const key = wallet.utils.generateAesKey(256); // 32 bytes for AES-256
233
+ const iv = wallet.utils.generateIv(); // 12 bytes
234
+
235
+ // Encrypt
236
+ const plaintext = new TextEncoder().encode('Secret data');
237
+ const { ciphertext, tag } = wallet.utils.aesGcm.encrypt(key, plaintext, iv);
238
+
239
+ // Decrypt
240
+ const decrypted = wallet.utils.aesGcm.decrypt(key, ciphertext, tag, iv);
241
+
242
+ // With additional authenticated data (AAD)
243
+ const aad = new TextEncoder().encode('context');
244
+ const enc = wallet.utils.aesGcm.encrypt(key, plaintext, iv, aad);
245
+ const dec = wallet.utils.aesGcm.decrypt(key, enc.ciphertext, enc.tag, iv, aad);
246
+ ```
247
+
248
+ ### Random Number Generation
249
+
250
+ ```javascript
251
+ // Generate cryptographically secure random bytes
252
+ const randomBytes = wallet.utils.getRandomBytes(32);
253
+
254
+ // Generate random IV for AES-GCM (12 bytes)
255
+ const iv = wallet.utils.generateIv();
256
+
257
+ // Generate random AES key (128, 192, or 256 bits)
258
+ const aes128Key = wallet.utils.generateAesKey(128);
259
+ const aes256Key = wallet.utils.generateAesKey(256);
260
+ ```
261
+
227
262
  ## Coin Types (SLIP-44)
228
263
 
229
264
  ```javascript