hd-wallet-wasm 1.2.4 → 1.2.6
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 +6 -6
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/index.d.ts +1 -1
- package/src/index.mjs +5 -5
package/README.md
CHANGED
|
@@ -128,20 +128,20 @@ const signing = getSigningKey(master, 60);
|
|
|
128
128
|
console.log('Signing pubkey:', wallet.utils.encodeHex(signing.publicKey));
|
|
129
129
|
console.log('Path:', signing.path); // "m/44'/60'/0'/0/0"
|
|
130
130
|
|
|
131
|
-
// Get encryption keypair for
|
|
132
|
-
const encryption = getEncryptionKey(master, WellKnownCoinType.
|
|
131
|
+
// Get encryption keypair for SDN (m/44'/1957'/0'/1/0)
|
|
132
|
+
const encryption = getEncryptionKey(master, WellKnownCoinType.SDN);
|
|
133
133
|
console.log('Encryption pubkey:', wallet.utils.encodeHex(encryption.publicKey));
|
|
134
134
|
|
|
135
135
|
// Use encryption key for ECDH key agreement
|
|
136
136
|
const shared = wallet.curves.secp256k1.ecdh(encryption.privateKey, otherPublicKey);
|
|
137
137
|
|
|
138
138
|
// Multiple keys per account (e.g., one per plugin)
|
|
139
|
-
const plugin0Key = getEncryptionKey(master,
|
|
140
|
-
const plugin1Key = getEncryptionKey(master,
|
|
139
|
+
const plugin0Key = getEncryptionKey(master, 1957, '0', '0');
|
|
140
|
+
const plugin1Key = getEncryptionKey(master, 1957, '0', '1');
|
|
141
141
|
|
|
142
142
|
// Path helpers are also available directly
|
|
143
143
|
const sigPath = buildSigningPath(60); // "m/44'/60'/0'/0/0"
|
|
144
|
-
const encPath = buildEncryptionPath(
|
|
144
|
+
const encPath = buildEncryptionPath(1957); // "m/44'/1957'/0'/1/0"
|
|
145
145
|
|
|
146
146
|
// Clean up
|
|
147
147
|
wallet.utils.secureWipe(signing.privateKey);
|
|
@@ -153,7 +153,7 @@ Also available as instance methods on the wallet module:
|
|
|
153
153
|
|
|
154
154
|
```javascript
|
|
155
155
|
const signing = wallet.getSigningKey(master, 60);
|
|
156
|
-
const encryption = wallet.getEncryptionKey(master,
|
|
156
|
+
const encryption = wallet.getEncryptionKey(master, 1957);
|
|
157
157
|
```
|
|
158
158
|
|
|
159
159
|
### Multi-Curve Cryptography
|
package/dist/index.d.ts
CHANGED
|
@@ -650,7 +650,7 @@ export function getEncryptionKey(hdRoot: HDKey, coinType: string | number, accou
|
|
|
650
650
|
|
|
651
651
|
/** Well-known coin types */
|
|
652
652
|
export enum WellKnownCoinType {
|
|
653
|
-
|
|
653
|
+
SDN = 1957,
|
|
654
654
|
BITCOIN = 0,
|
|
655
655
|
ETHEREUM = 60,
|
|
656
656
|
SOLANA = 501,
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -650,7 +650,7 @@ export function getEncryptionKey(hdRoot: HDKey, coinType: string | number, accou
|
|
|
650
650
|
|
|
651
651
|
/** Well-known coin types */
|
|
652
652
|
export enum WellKnownCoinType {
|
|
653
|
-
|
|
653
|
+
SDN = 1957,
|
|
654
654
|
BITCOIN = 0,
|
|
655
655
|
ETHEREUM = 60,
|
|
656
656
|
SOLANA = 501,
|
package/src/index.mjs
CHANGED
|
@@ -2784,7 +2784,7 @@ function createModule(wasm) {
|
|
|
2784
2784
|
* @example
|
|
2785
2785
|
* buildSigningPath(60); // "m/44'/60'/0'/0/0" (Ethereum)
|
|
2786
2786
|
* buildSigningPath(0, '0', '1'); // "m/44'/0'/0'/0/1" (Bitcoin, 2nd key)
|
|
2787
|
-
* buildSigningPath(
|
|
2787
|
+
* buildSigningPath(1957); // "m/44'/1957'/0'/0/0" (Space Data Network)
|
|
2788
2788
|
*/
|
|
2789
2789
|
export function buildSigningPath(coinType, account = '0', index = '0') {
|
|
2790
2790
|
return `m/44'/${coinType}'/${account}'/0/${index}`;
|
|
@@ -2804,7 +2804,7 @@ export function buildSigningPath(coinType, account = '0', index = '0') {
|
|
|
2804
2804
|
*
|
|
2805
2805
|
* @example
|
|
2806
2806
|
* buildEncryptionPath(60); // "m/44'/60'/0'/1/0" (Ethereum)
|
|
2807
|
-
* buildEncryptionPath(
|
|
2807
|
+
* buildEncryptionPath(1957, '0', '3'); // "m/44'/1957'/0'/1/3" (SDN, 4th plugin key)
|
|
2808
2808
|
*/
|
|
2809
2809
|
export function buildEncryptionPath(coinType, account = '0', index = '0') {
|
|
2810
2810
|
return `m/44'/${coinType}'/${account}'/1/${index}`;
|
|
@@ -2860,7 +2860,7 @@ export function getSigningKey(hdRoot, coinType, account = '0', index = '0') {
|
|
|
2860
2860
|
* const wallet = await createHDWallet();
|
|
2861
2861
|
* const seed = wallet.mnemonic.toSeed(mnemonic);
|
|
2862
2862
|
* const root = wallet.hdkey.fromSeed(seed);
|
|
2863
|
-
* const { privateKey, publicKey } = getEncryptionKey(root,
|
|
2863
|
+
* const { privateKey, publicKey } = getEncryptionKey(root, 1957, '0', '0');
|
|
2864
2864
|
* // Use publicKey for ECIES encryption, privateKey for decryption
|
|
2865
2865
|
* const shared = wallet.curves.secp256k1.ecdh(privateKey, otherPublicKey);
|
|
2866
2866
|
*/
|
|
@@ -2884,8 +2884,8 @@ export function getEncryptionKey(hdRoot, coinType, account = '0', index = '0') {
|
|
|
2884
2884
|
* @enum {number}
|
|
2885
2885
|
*/
|
|
2886
2886
|
export const WellKnownCoinType = Object.freeze({
|
|
2887
|
-
/**
|
|
2888
|
-
|
|
2887
|
+
/** Space Data Network identity (1957 = Sputnik launch year) */
|
|
2888
|
+
SDN: 1957,
|
|
2889
2889
|
/** Bitcoin */
|
|
2890
2890
|
BITCOIN: 0,
|
|
2891
2891
|
/** Ethereum */
|