]> zoso.dev Git - libnemo.git/commitdiff
Extend bip44ckd to listen for coin input.
authorChris Duncan <chris@zoso.dev>
Sat, 7 Dec 2024 21:35:16 +0000 (13:35 -0800)
committerChris Duncan <chris@zoso.dev>
Sat, 7 Dec 2024 21:35:16 +0000 (13:35 -0800)
src/lib/bip44-ckd.ts

index ab1fdca00bc5188ae0b6743cde64df71b8d45fd7..e4307520d6c46c743078be5681c7a335dbbbc856 100644 (file)
@@ -28,7 +28,11 @@ const b = () => {
        async function calculate (data: any[]): Promise<any[]> {
                return new Promise(async (resolve) => {
                        for (const d of data) {
-                               d.privateKey = await nanoCKD(d.seed, d.index)
+                               if (d.coin != null && d.coin !== BIP44_PURPOSE) {
+                                       d.privateKey = await ckd(d.seed, d.coin, d.index)
+                               } else {
+                                       d.privateKey = await nanoCKD(d.seed, d.index)
+                               }
                        }
                        resolve(data)
                })