import { C } from "https://deno.land/x/lucid@0.10.10/mod.ts";
const { Bip32PrivateKey } = C;
derive this private key with the given index.
Security considerations
- hard derivation index cannot be soft derived with the public key
Hard derivation vs Soft derivation
If you pass an index below 0x80000000 then it is a soft derivation. The advantage of soft derivation is that it is possible to derive the public key too. I.e. derivation the private key with a soft derivation index and then retrieving the associated public key is equivalent to deriving the public key associated to the parent private key.
Hard derivation index does not allow public key derivation.
This is why deriving the private key should not fail while deriving the public key may fail (if the derivation index is invalid).