def boot() -> None: ns = [] for i in all_slip44_ids_hardened(): ns.append([CURVE, HARDENED | 44, i]) wire.add(MessageType.EthereumGetAddress, __name__, "get_address", ns) wire.add(MessageType.EthereumGetPublicKey, __name__, "get_public_key", ns) wire.add(MessageType.EthereumSignTx, __name__, "sign_tx", ns) wire.add(MessageType.EthereumSignMessage, __name__, "sign_message", ns) wire.add(MessageType.EthereumVerifyMessage, __name__, "verify_message")
def validate_full_path(path: list) -> bool: """ Validates derivation path to equal 44'/60'/0'/0/i, where `i` is an address index from 0 to 1 000 000. """ if len(path) != 5: return False if path[0] != 44 | HARDENED: return False if path[1] not in networks.all_slip44_ids_hardened(): return False if path[2] != 0 | HARDENED: return False if path[3] != 0: return False if path[4] > 1000000: return False return True
def validate_path_for_get_public_key(path: list) -> bool: """ This should be 44'/60'/0', but other non-hardened items are allowed. """ length = len(path) if length < 3 or length > 5: return False if path[0] != 44 | HARDENED: return False if path[1] not in networks.all_slip44_ids_hardened(): return False if path[2] != 0 | HARDENED: return False if length > 3 and paths.is_hardened(path[3]): return False if length > 4 and paths.is_hardened(path[4]): return False return True