1
0

keystore.sign_message: add optional script_type argument

this is used by trezor
(and also by bitbox02, which was using a workaround previously)

fixes https://github.com/spesmilo/electrum/issues/7670
This commit is contained in:
SomberNight
2022-02-22 19:20:03 +01:00
parent 6603359c20
commit 376fc01b27
11 changed files with 37 additions and 21 deletions

View File

@@ -499,7 +499,12 @@ class ECPrivkey(ECPubkey):
def sign_transaction(self, hashed_preimage: bytes) -> bytes:
return self.sign(hashed_preimage, sigencode=der_sig_from_r_and_s)
def sign_message(self, message: bytes, is_compressed: bool, algo=lambda x: sha256d(msg_magic(x))) -> bytes:
def sign_message(
self,
message: Union[bytes, str],
is_compressed: bool,
algo=lambda x: sha256d(msg_magic(x)),
) -> bytes:
def bruteforce_recid(sig_string):
for recid in range(4):
sig65 = construct_sig65(sig_string, recid, is_compressed)