def get_from_path(cls, mnemonic: str, path: str) -> "DerivableKey": """Gets the derived key in one go from address/motion path string""" # address, motion = path.split("/") # No: motion txid can contain "/" => coud use same limit param from split as above. elements = path.split("/") address = elements.pop(0) motion = "/".join(elements) bip39 = BIP39.from_mnemonic(mnemonic) master_key = DerivableKey(seed=bip39.to_seed()) address_key = master_key.derive(address) motion_key = address_key.derive(motion) return motion_key
def test_seed(verbose=False): bip39 = BIP39.from_mnemonic(TEST_MNEMONIC) if verbose: print("Entropy", bip39.entropy.hex()) assert bip39.entropy.hex() == "80808080808080808080808080808080" seed = bip39.to_seed() if verbose: print("Seed", seed.hex()) assert seed.hex() == TEST_SEED_HEX key = DerivableKey(seed=seed) if verbose: print("Pubkey", key.to_pubkey().hex()) print("AES key", key.to_aes_key().hex()) assert ( key.to_pubkey().hex() == "0418b9908d43f503ae8ed3128c35edd8e0b9350c01a389bf5d83aece4822722b6223dbfaec15801253d658356836802a43c401fed1415a312f1a09f52d96a52ae4" ) assert (key.to_aes_key().hex() == "3b49e2c776a2a8c3a1b5666ab19e3b1103bb4a435efc70eadf829bfd59c06e20")