From: Chris Duncan Date: Sat, 9 Aug 2025 07:30:35 +0000 (-0700) Subject: Fix BIP-44 ckd using SLIP-0010 which only defines hardened addresses at all levels... X-Git-Tag: v0.10.5~41^2~150 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=639ae3b9cd60dda213f86e2b3a34431c7155b2b6;p=libnemo.git Fix BIP-44 ckd using SLIP-0010 which only defines hardened addresses at all levels, deviating from BIP-44. --- diff --git a/src/lib/crypto/bip44.ts b/src/lib/crypto/bip44.ts index 81c4823..59210ba 100644 --- a/src/lib/crypto/bip44.ts +++ b/src/lib/crypto/bip44.ts @@ -31,9 +31,9 @@ export class Bip44 { const coinKey = await this.CKDpriv(purposeKey, coin + HARDENED_OFFSET) const accountKey = await this.CKDpriv(coinKey, account + HARDENED_OFFSET) if (chain == null) return accountKey.privateKey - const chainKey = await this.CKDpriv(accountKey, chain) + const chainKey = await this.CKDpriv(accountKey, chain + HARDENED_OFFSET) if (address == null) return chainKey.privateKey - const addressKey = await this.CKDpriv(chainKey, address) + const addressKey = await this.CKDpriv(chainKey, address + HARDENED_OFFSET) return addressKey.privateKey }