hd-wallet-wasm 1.4.3 → 1.5.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/dist/index.d.ts +6 -0
- package/package.json +1 -1
- package/src/index.d.ts +6 -0
- package/src/index.mjs +18 -0
package/dist/index.d.ts
CHANGED
|
@@ -658,6 +658,12 @@ export interface Libp2pAPI {
|
|
|
658
658
|
|
|
659
659
|
/** Compute IPNS hash (CIDv1 base32lower, 'b' prefix) */
|
|
660
660
|
ipnsHashBase32(peerIdBytes: Uint8Array): string;
|
|
661
|
+
|
|
662
|
+
/** Derive PeerID string directly from a Base58Check-encoded xpub */
|
|
663
|
+
peerIdFromXpub(xpub: string): string;
|
|
664
|
+
|
|
665
|
+
/** Derive IPNS hash (CIDv1 base36lower) directly from an xpub */
|
|
666
|
+
ipnsHashFromXpub(xpub: string): string;
|
|
661
667
|
}
|
|
662
668
|
|
|
663
669
|
// =============================================================================
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -658,6 +658,12 @@ export interface Libp2pAPI {
|
|
|
658
658
|
|
|
659
659
|
/** Compute IPNS hash (CIDv1 base32lower, 'b' prefix) */
|
|
660
660
|
ipnsHashBase32(peerIdBytes: Uint8Array): string;
|
|
661
|
+
|
|
662
|
+
/** Derive PeerID string directly from a Base58Check-encoded xpub */
|
|
663
|
+
peerIdFromXpub(xpub: string): string;
|
|
664
|
+
|
|
665
|
+
/** Derive IPNS hash (CIDv1 base36lower) directly from an xpub */
|
|
666
|
+
ipnsHashFromXpub(xpub: string): string;
|
|
661
667
|
}
|
|
662
668
|
|
|
663
669
|
// =============================================================================
|
package/src/index.mjs
CHANGED
|
@@ -3881,6 +3881,24 @@ function createModule(wasm) {
|
|
|
3881
3881
|
wasm._hd_dealloc(cidPtr);
|
|
3882
3882
|
wasm._hd_dealloc(outPtr);
|
|
3883
3883
|
}
|
|
3884
|
+
},
|
|
3885
|
+
|
|
3886
|
+
peerIdFromXpub(xpubStr) {
|
|
3887
|
+
const key = hdkey.fromXpub(xpubStr);
|
|
3888
|
+
try {
|
|
3889
|
+
return key.peerIdString();
|
|
3890
|
+
} finally {
|
|
3891
|
+
key.wipe();
|
|
3892
|
+
}
|
|
3893
|
+
},
|
|
3894
|
+
|
|
3895
|
+
ipnsHashFromXpub(xpubStr) {
|
|
3896
|
+
const key = hdkey.fromXpub(xpubStr);
|
|
3897
|
+
try {
|
|
3898
|
+
return key.ipnsHash();
|
|
3899
|
+
} finally {
|
|
3900
|
+
key.wipe();
|
|
3901
|
+
}
|
|
3884
3902
|
}
|
|
3885
3903
|
};
|
|
3886
3904
|
|