Skip to main content

validate_bip32_path

Function validate_bip32_path 

Source
pub fn validate_bip32_path(path: &str) -> Result<(), String>
Expand description

Reject BIP-32 path components whose parsed index overflows the harden bit.

coins-bip32 parses 2147483648' as harden_index(0x8000_0000) which wraps to 0, silently selecting the wrong (unhardened) child. Raw 2147483648 is also rejected because it already equals the harden bit (0').

This is only an overflow guard. One trailing ' or h is stripped so the numeric index can be checked; malformed syntax is left to [MnemonicBuilder].