Responds to RFCs in PR #2262

pull/2220/head
Kieran Prasch 2020-09-17 10:58:06 -07:00
parent a9af58764d
commit 180ae82b7b
No known key found for this signature in database
GPG Key ID: 199AB839D4125A62
2 changed files with 9 additions and 7 deletions

View File

@ -171,15 +171,17 @@ class TrezorSigner(Signer):
return list(self.__addresses.keys())
@handle_trezor_call
def sign_message(self, message: bytes, checksum_address: str) -> Signer.SignedMessage:
def sign_message(self, message: bytes, checksum_address: str) -> HexBytes:
"""
Signs a message via the TREZOR ethereum sign_message API and returns
a named tuple containing the signature and the address used to sign it.
This method requires interaction between the TREZOR and the user.
"""
hd_path = self.__get_address_path(checksum_address=checksum_address)
signed_message = trezorlib.ethereum.sign_message(self.__client, hd_path, message)
return self.SignedMessage(signed_message.signature, signed_message.address)
# TODO: #2262 Implement Trezor Message Signing
# hd_path = self.__get_address_path(checksum_address=checksum_address)
# signed_message = trezorlib.ethereum.sign_message(self.__client, hd_path, message)
# return self.SignedMessage(signed_message.signature, signed_message.address)
raise NotImplementedError # TODO: #2261 return a Signer.SignedMessage instead
def sign_transaction(self,
transaction_dict: dict,

View File

@ -93,7 +93,7 @@ class Web3Signer(Signer):
@validate_checksum_address
def sign_message(self, account: str, message: bytes, **kwargs) -> HexBytes:
signature = self.__client.sign_message(account=account, message=message)
return HexBytes(signature)
return HexBytes(signature) # TODO: #2261 return a Signer.SignedMessage instead
def sign_transaction(self, transaction_dict: dict) -> HexBytes:
signed_raw_transaction = self.__client.sign_transaction(transaction_dict=transaction_dict)
@ -202,7 +202,7 @@ class ClefSigner(Signer):
raise NotImplementedError
signed_data = self.__ipc_request("account_signData", content_type, account, data)
return HexBytes(signed_data)
return HexBytes(signed_data) # TODO: #2261 return a Signer.SignedMessage instead
def sign_data_for_validator(self, account: str, message: bytes, validator_address: str):
signature = self.sign_message(account=account,
@ -391,4 +391,4 @@ class KeystoreSigner(Signer):
def sign_message(self, account: str, message: bytes, **kwargs) -> HexBytes:
signer = self.__get_signer(account=account)
signature = signer.sign_message(signable_message=encode_defunct(primitive=message)).signature
return signature
return signature # TODO: #2261 return a Signer.SignedMessage instead